Related to mod_proxy_balancer tutorial

Discussion in 'HOWTO-Related Questions' started by GRK, Sep 24, 2007.

  1. GRK

    GRK New Member

    I have realized the tutorial with success but i have a problem with my database.. the think is that i have only one server of mysql database in the first server and in the another not, and i dont think to install another database server yet, the think is i need to connect the second server to the one or use the first database server for the second apache, for my PHP aplications, how can i do this? i tried to create a user with privileges to access the database server one from the another server but i cannot conect throught mysql_conect() function. Can you help me? the webs are the same in server one and two, because of that i need this, tnxs.

    Regards.
     
  2. falko

    falko Super Moderator Howtoforge Staff

    Can you try this?
    Code:
    mysql -h [I]IP_address_of_first_server[/I] -u root -p
    Does that work?

    Otherwise I suggest that you take a look at the GRANT syntax: http://dev.mysql.com/doc/refman/5.0/en/grant.html

    Oh, and make sure that MySQL is using TCP on the first server and that port 3306 isn't blocked by a firewall.
     
  3. GRK

    GRK New Member

    mysql -h *.*.*.* -u root -p
    Enter password:
    ERROR 1045 (28000): Access denied for user 'root'@'*.*.*.*' (using password: YES)

    this is the message when i tried to connect from the second server to first. i will investigate why.

    thanks falko!
     
  4. GRK

    GRK New Member

    CREATE USER 'root'@'*.*.*.*' IDENTIFIED BY '******';

    GRANT ALL PRIVILEGES ON * . * TO 'root'@'*.*.*.*'' IDENTIFIED BY '******' WITH GRANT OPTION MAX_QUERIES_PER_HOUR 0 MAX_CONNECTIONS_PER_HOUR 0 MAX_UPDATES_PER_HOUR 0 MAX_USER_CONNECTIONS 0 ;

    i have created a new user with this privileges and i can log in the server, but the mysql_connect() cannot connect to the server, why?
     
  5. GRK

    GRK New Member


    How i can view if the first server is using that?
     
  6. falko

    falko Super Moderator Howtoforge Staff

    Run
    Code:
    netstat -tap|grep -i mysql
    MySQL should show up in the output.

    Can you try this with the second server's hostname instead of the IP address?
     
  7. GRK

    GRK New Member


    this is the output in the first server:

    tcp 0 0 *:mysql *:* LISTEN 26910/mysqld

    tcp 0 0 hgn1.server1.com:38347 hgn2.server2.com:mysql ESTABLISHED 26910/mysqld

    (the names of the server are ficticious)
    the second line i think is the replication of database, that works well, i installed another database server in the second server as slave and works fine, but is not that i want, i dont want master to master replication because duplicate entry error, and is not my first option.

    the other code:

    GRANT ALL PRIVILEGES ON * . * TO 'root'@'server_ip_two'' IDENTIFIED BY '******' WITH GRANT OPTION MAX_QUERIES_PER_HOUR 0 MAX_CONNECTIONS_PER_HOUR 0 MAX_UPDATES_PER_HOUR 0 MAX_USER_CONNECTIONS 0 ;

    i have do this , in the first time when i have posted, i used the second ip server, i put '*' to not publish the ip but doesnt work, the error in the PHP is: is the server running on server_ip_one... from the second, and there is not firewall or something that blocking the connection.

    i dont know what happen :(
     
  8. falko

    falko Super Moderator Howtoforge Staff

    Can you try this with the second server's hostname instead of the IP address?
     

Share This Page