WordPress error: Error establishing a database connection

Discussion in 'WordPress' started by electroze, Aug 26, 2012.

  1. #1
    Hi, I'm in a bind. I moved my WordPress site to a new server and getting this error 'Error establishing a database connection'. It periodically shows this error too:
    "Not Found The requested URL /home4/kingjame/public_html/search.php was not found on this server."

    How I got here:
    My wordpress was hacked months ago and I could no longer login, though the site stuff worked fine to users. I tried replacing wp_admin folder to gain access, but then broke the whole site. I decided to move to a new server. I first installed fresh wordpress install on new server. Then I made separate database and uploaded my previous database there (export and import via phpmyadmin). I then edited wp-config and switched over to the previous database. It then gives error 'Error establishing a database connection' or '404 The requested URL /home4/kingjame/public_html/search.php was not found on this server."

    What I've tried so far without success:
    - Removing all references to /home4/kingjame/public_html/ in commentsmeta
    - Removed plugins
    - Added plugins back
    - Removed references to plugins in wp_options
    - Removed permalinks from /*postname*/ to blank.

    Still get same error. If I switch wp-config back to fresh install blank database, it works fine, so I know my files are ok. It's something in my database or wp-config.

    Any ideas?
     
    electroze, Aug 26, 2012 IP
  2. nufox

    nufox Peon

    Messages:
    749
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #2
    - First, try contacting the hosting provider if the database server is online / if they have any other problem at their end, or they made any changes to your account, or if there are any limitations/restrictions, if the hosting package is set to Windows and not Linux, etc .

    - 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. You can get that info from your hosting provider.

    -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 hosting provider.
     
    nufox, Aug 26, 2012 IP
  3. learnable

    learnable Peon

    Messages:
    38
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Yes,
    You need to contact your hosting provider if they can fix the problem, or you can check yourself the database username and password and then change it from wp-config
    Or if you don't know the process, just Google how to fix " the error name"
    And you will get your answer more easily.
     
    learnable, Aug 26, 2012 IP