• Resolved andrewsmd87

    (@andrewsmd87)


    I had my wordpress db running on 5.1.22 version of mysql. I moved the db to a new server with the newest version of mysql running. Now, when I browse to my site I get the generic “can’t connect to db” error. I know my connection information is correct, I have verified through the command line and through a test.php page I put on my site it connected to the db fine. However, when I put that info into the wp-config file, it can’t connect. Could this be a mysql version problem or something?

Viewing 5 replies - 1 through 5 (of 5 total)
  • Moderator t-p

    (@t-p)

    -First, double check your wp-config.php file settings for the database name, database username and database password. This is where most errors occur.

    -Then check that you don’t need to change the database host from “localhost” to something else.

    -Check you have actually created a database with the same database name as is in your wp-config.php file.

    -Last, but not least, if all that information is correct your database probably has a problem with it and you may need to contact your web hosting.

    There are also many threads on this topic on these forums: http://wordpress.org/search/Error+establishing+a+database+connection?forums=1

    Thread Starter andrewsmd87

    (@andrewsmd87)

    1. I did double check all of that. As I said, I created a temp.php file with mysql connectors and connected to the new database. I then copy and pasted that login information to the wp-config to make sure it was the same.
    2. The old host and new host are different ips, I accounted for that with my test.php file, it has the new host ip.
    3. Once again, the db name is correct because I can connect via php

    I run these host servers, I can connect via the command line and via my custom php file, this is why I was asking if there were any known issues with wordpress and the newest version of mysql. Like an updated password scheme or something.

    Moderator t-p

    (@t-p)

    this is why I was asking if there were any known issues with wordpress and the newest version of mysql. Like an updated password scheme or something.

    I am not aware of any such issue.

    Thread Starter andrewsmd87

    (@andrewsmd87)

    FYI, I finally figured this out. I used a mysql migration tool to move my database over, while everything looked ok, something did not move over right. I only found this out after I tried to move another completely different system and got weird errors. The migration tool kit would move some of the data but not everything. Once I moved the db manually via the mysql command line, it worked fine. What threw me off, is that word press was saying it couldn’t connect when it really could, there was just some error with the database. I hope this saves someone else the time.

    Moderator t-p

    (@t-p)

    Glad you got it sorted. 🙂

    Please mark this thread “resolved” using the dropdown in the right panel.

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘Can't connect to DB’ is closed to new replies.