Support » Installing WordPress » Getting Error establishing a database connection

  • Resolved witness777

    (@witness777)


    I have an Ubuntu Server 16.04.5 vm on virtualbox 5.2.20. After following the guide here on installing wordpress I get the error below after running http://192.168.93.105/wp-admin/setup-config.php in my browser:

    Sorry, I need a wp-config-sample.php file to work from. Please re-upload this file to your WordPress installation.

    So, I then changed the name of the wp-config.php file back to wp-config-sample.php. I then refreshed my browser and it works! WRONG!

    I select my language, read the information and click ‘Let’s go!’…everything works so far. I then put in the db name, username, password and host in the browser. When I click Submit I get the below error:

    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 192.168.93.105. 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.

    There were one thing I noticed. It looks like it is NOW looking for a wp-config.php file. I’m not understanding why at first it wanted the -sampl.php file and afterwards wants the config.php file.

    I also tried keeping both wp-config.php and wp-config-sample.php file and I’m just running into issues.

    Can someone point me in the right direction?

Viewing 2 replies - 1 through 2 (of 2 total)
  • There were one thing I noticed. It looks like it is NOW looking for a wp-config.php file. I’m not understanding why at first it wanted the -sampl.php file and afterwards wants the config.php file.

    The installer needs the wp-config-sample.php dummy file to create the working wp-config.php file for you automatically when you supply it the correct database connection credentials.

    When you just rename wp-config-sample.php file to wp-config.php, it won’t work because you’ll only have dummy configuration info in it. You’ll need to manually edit the file with the correct info before the site will run. This is what the installer does for you automatically.

    I select my language, read the information and click ‘Let’s go!’…everything works so far. I then put in the db name, username, password and host in the browser. When I click Submit I get the below error:

    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 192.168.93.105. This could mean your host’s database server is down.

    Try localhost as the database host.

    If it doesn’t work, use the same credentials to try connecting to the database server directly from the command line and see if you can make a successful connection.

    George,

    I didn’t just rename the .php file. I changed the db name, db username and password parameters to what I had specified during the install.

    I did however set the db host to localhost and I got past step2! Hope this goes well.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Getting Error establishing a database connection’ is closed to new replies.