Support » Installing WordPress » Error connecting to database….

  • Hi all.

    I am literally banging my head against the wall with this problem:

    I moved my blog ( to a new server, moved all files, backed up database, imported old DB to new DB, changed wp-config.php and added new db name, password and local host.

    but i am still getting “error connecting to database”

    for love nor money can i figure this problem out…

    any help will be highly appreciated.

Viewing 6 replies - 1 through 6 (of 6 total)
  • Hi,

    Me also as of last night. Have had to email my Support Desk.. as usual. I use inmotionhosting in the US and they are normally quick to respond. Not this time though. I get the localhost problem everytime I setup a MySQL database.


    Same problem here. My hosting provider ServerSea transferred two of my websites and to a new server of theirs as their earlier crashed.

    Although all files were moved and DB was imported by me, the dreaded ‘error connecting to database’ error.

    Can anyone help us?

    Also avoid ServerSea. Their service sucks!

    Moderator James Huff


    Halfelf Minion 🚀

    saqib62, contact your hosting provider to confirm that the values entered into wp-config.php are correct. More than likely, the DB_HOST value is different on the new server.

    but i am still getting “error connecting to database”

    Have you confirmed that the database username, password and hostname are correct by connecting to the database using phpMyAdmin?

    Saqib Khan


    Thanks James for the tip. No, the DB_host was the same.

    I have finally succeeded in getting Restaurants Uncut up and running.

    And here’s how I did it. On the old server, I only had to write the database and username without any prefix. However, on the new server, both these terms needed to have the the domain as the prefix in the wp-config file.

    For example Martin would add these values garstangblog_database and garstangblog_username.

    However, for some inexplicable reason the same technique is not working on Brandasy.

    Here’s the error when I try to access the /wp-admin:

    Can’t select database

    We were able to connect to the database server (which means your username and password is okay) but not able to select the brandasy_brand database.

    * Are you sure it exists?
    * Does the user brandasy_saqib have permission to use the brandasy_brand database?
    * On some systems the name of your database is prefixed with your username, so it would be like username_brandasy_brand. Could that be the problem?

    Now why did restaurants uncut work and brandasy didn’t when I had used exactly the same technique on both?

    Any help would be greatly appreciated.



    Forum Moderator

    Different hosting accounts manage, and name, their databases differently.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Error connecting to database….’ is closed to new replies.