Support » Installing WordPress » after restoring files, database connection error

  • Yes, I know there are a million threads about the “Error establishing a database connection” message, but they haven’t solved the problem for me, so here we go again…

    My website has been wordpress-based for a few years and working fine. In fairness, the last update I did was probably in 2012. Today, I accidentally deleted some crucial files while messing around in an FTP client. Thankfully, my host stores backups and I was able to restore my files. happy ending? no. Now, I’m getting that infamous error.

    Obviously, I never changed the wp-config.php file to make it STOP working. But just to be sure, I checked it to make sure my database, username, password and host were all correct. And double checked. All that info is correct. And I know the host is not down because I spent 90 minutes with them trying to figure out the problem, and ultimately they said, “ask wordpress”. That brought me to the forums, which have either told me things I already know, or things beyond my comprehension.

    Is there something I’m missing? Any help out there would be greatly appreciated.

Viewing 3 replies - 1 through 3 (of 3 total)
  • nice

    ok so first you need to know

    database name
    database user
    database password

    then you can test the connection to the database using a sample script

    put this in a text file name it dbtest.php
    upload it to your server with the right configuration

    $server   = "localhost";
    $database = "database";
    $username = "user";
    $password = "password";
    $mysqlConnection = mysql_connect($server, $username, $password);
    if (!$mysqlConnection)
      echo "Not Working";
    mysql_select_db($database, $mysqlConnection);
      echo "Working";
    Hardeep Asrani


    Support Team Volunteer

    Go to your hosting panel, and change the password of your database & then try to re-create wp-config.php file.

    Try to restore db from backup again (can be different from files backup) and check wp-config.php for login-pass details.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘after restoring files, database connection error’ is closed to new replies.