Help: Setting up MySql remote access

Discussion in 'MySQL' started by muhabbatain, Dec 19, 2012.

  1. #1
    I have 2 dedicated servers one with Cpanel and other one with plesk. I want my main server (Cpanel) to access mysql database from 2nd server (Plesk) to balance the load. I still can not figure it out how to do it. Can anyone help me please? Thanks
     
    Solved! View solution.
    muhabbatain, Dec 19, 2012 IP
  2. Rukbat

    Rukbat Well-Known Member

    Messages:
    2,908
    Likes Received:
    37
    Best Answers:
    51
    Trophy Points:
    125
    #2
    Connect to the database by IP address.
     
    Rukbat, Dec 20, 2012 IP
  3. muhabbatain

    muhabbatain Active Member

    Messages:
    195
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    51
    #3
    muhabbatain, Dec 20, 2012 IP
  4. Rukbat

    Rukbat Well-Known Member

    Messages:
    2,908
    Likes Received:
    37
    Best Answers:
    51
    Trophy Points:
    125
    #4
    The database may not have a user authorized to connect to it from server1's IP address.
     
    Rukbat, Dec 20, 2012 IP
  5. muhabbatain

    muhabbatain Active Member

    Messages:
    195
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    51
    #5
    could you please tell me how to do that?
     
    muhabbatain, Dec 20, 2012 IP
  6. Rukbat

    Rukbat Well-Known Member

    Messages:
    2,908
    Likes Received:
    37
    Best Answers:
    51
    Trophy Points:
    125
    #6
    Use phpMyAdmin. Select the database. Click on Privileges. Click on Add a New User. In Host, choose either Any Host (that could be a bit of a security risk) or select Use text field, and type in the IP address of Server1.
     
    Rukbat, Dec 21, 2012 IP
  7. muhabbatain

    muhabbatain Active Member

    Messages:
    195
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    51
    #7
    Hi Rukbat, I really appreciate your help. I have tried that but getting the same error. I even grant permissions via SSH

    GRANT ALL ON foo.* TO bar@'192.168.0.1' IDENTIFIED BY 'PASSWORD';

    am I entering the right info in config.php

    define("DB_SERVER", '192.168.0.1'); i also tried 192.168.0.1:3306
    define("DB_USER",'user');
    define("DB_PASS",'pass');
    define("DB_NAME", 'db_name');
     
    muhabbatain, Dec 21, 2012 IP
  8. #8
    3306 is the default port, so that's not the problem.

    Are you sure that Server2 is set up to allow remote connections to the MySQL database?

    Are you sure your definitions are correct - the user, password and name of the database? (I know you're just showing examples, but your examples, if they were the real data, wouldn't work.)
     
    Rukbat, Dec 21, 2012 IP
  9. muhabbatain

    muhabbatain Active Member

    Messages:
    195
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    51
    #9
    Thank you Rukbat for your help. I didn't bind mysql server to remote IP. Its working now. :)
     
    muhabbatain, Dec 25, 2012 IP