WordPress + Remote Database = Error Establishing Connection

I am trying to move my database offsite to a separate dedicated box which my wordpress can connect to remotely. I have already done the requisite dumps, imports, and permissions. After changing wp-config’s DB_HOST from localhost to the remote IP, I am getting the big bold “ERROR ESTABLISHING CONNECTION” message and a blank page.

I can currently access the remote mysql database from linux commandline using:

Read More
mysql -u USER -p -h REMOTE_IP

and everything works fine. so I know all the permissions are set up, and everything is in order.

Yet when I put the same credentials into the silly wordpress config, it’s not working. Any ideas? I turned on mysql error logging but nothing is showing up from these failed attempts.

Related posts

Leave a Reply

3 comments

  1. This is old but I’ll reply anyway in case anyone comes across this.

    I had a similar problem earlier. My config file was correct and my database was remotely accessible from my box running apache, like your situation. I figured the problem had to be that apache wasn’t allowed to make a connection to the database… or something along those lines.

    That being said, try running this if SELinux is enabled:

    setsebool -P httpd_can_network_connect=1
    
    1. Locate the mysql config file /etc/mysql/my.conf.
    2. change the bind address to 0.0.0.0

    then try this
    mysql -h your_target_ip -u user_name -p

    If it shows any error please replay here I will help you