• Hi

    I have WordPress installed on one server where it is running well. I would like to connect to a mySQL database on another (database server).

    I have followed the instructions to set up a WordPress database and granted privileges to a WordPress user.

    I used the following GRANT statement as I read to access the mySQL remotely one must specify the ip address of the remote site when when granting the privileges to the user.

    GRANT ALL PRIVILEGES ON wordpress.* TO “wordpress”@”196.21.45.%” IDENTIFIED BY “wordpress123”

    The config file for on WordPress on the first server looks as follows.

    define(‘DB_NAME’, ‘wordpress’); // The name of the database
    define(‘DB_USER’, ‘wordpress’); // Your MySQL username
    define(‘DB_PASSWORD’, ‘wordpress123’); // …and password
    define(‘DB_HOST’, ‘my-database-ip’); // 99% chance you won’t need to change this value

    A connection, however, cannot be made to the mySQL database at the ip “my-database-ip”. I get the WordPress “error establishing database connection” page.

    Anybody got any advice.

Viewing 4 replies - 1 through 4 (of 4 total)
  • Is the “my-database-ip” host firewalled?
    Is MySQL setup to allow connections from the outside?

    Thread Starter mcocks

    (@mcocks)

    No the my-database-ip is not Firewalled the server can connect to MSSQL on the database server – could this be a problem?

    I set up MySQL to allow connections from outside.

    I’m using WP with a DB in another machine. Its working fine with me.
    But I hadn’t to do nothing because I guess the admin of DB toke care of that.

    Can you manually connect? Either use a command line, gui app, or web gui (if it is a hosted web). Are you sure that the MySQL privs are correct? Did you reload the grant tables after adding the user?

    However, are you doing this over the internet? If so you should be very careful. I wouldn’t do it at all, never. Even with IP rules. Use a VPN if you can.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Connection between MySQL and WordPress on separate machines.’ is closed to new replies.