Divi WordPress Theme
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

WordPress Error establish connection even though mysql command line works

Discussion in 'Misc WordPress Requests' started by mwbelt, Mar 20, 2018.

  1. mwbelt


    Error establish connection even though mysql command line works, by mwbelt

    This is far and away not my first WP install, but it’s the first time I’ve seen this and I can’t find a workaround.

    I have two servers, which for argument’s sake are web1 and db2. Let’s say their IPs are and respectively.

    I’ve created the WP user and database on db2 along with appropriate privileges, flushed the table, etc. etc. If I am SSH’d into web1, I can easily connect as that user to the database on db2. To wit:
    mysql –user=theusername –password=thepassword –host= databasename

    This works fine. I can get in, create and drop tables, etc. HOWEVER, putting those EXACT same credentials and host info into the installation dialog (or directly into wp-config.php) results in the old familiar:

    Error establishing a database connection
    This either means that the username and password information in your wp-config.php file is incorrect or we can’t contact the database server at This could mean your host’s database server is down.

    Are you sure you have the correct username and password?
    Are you sure that you have typed the correct hostname?
    Are you sure that the database server is running?
    If you’re unsure what these terms mean you should probably contact your host. If you still need help you can always visit the WordPress Support Forums.

    Nothing works. I have tried any workaround I can think of, and I am now banging my head against my desk.

    Error establish connection even though mysql command line works

Share This Page

Monarch Social Sharing Plugin