Error establishing database connection (2 posts)

  1. CutmanCometh
    Posted 3 years ago #

    My WordPress local site just shows the following error: Error establishing database connection.


    I'm pretty new to WordPress, nevertheless I have a client who wants me to further develop his already-existing site, which was originally built in WordPress. (I'm used to coding sites by hand, so I'm familiar with all the languages and technologies involved: html, css, javascript, php, mysql, apache administration, linux admin, and so forth)

    I'm trying to set up a development environment so that I can play around with ideas for his site without them showing up on the live site.I've set up a dev server with Ubuntu 12.04 LTS, the latest version of Apache2, PHP 5.3, and the latest MySQL server.

    I added a "wordpress"@"localhost" user to MySQL and granted him all privileges on the wordpress database, which I also created.

    Then, I simply copied the entire site from it's location on godaddy's host to /var/www/ on my server. I went into wp-config.php and changed the user name and database name to "wordpress" and the password to the appropriate password, and the host to "localhost".

    Finally, I did a complete dump of the database from the live site and inserted it into the wordpress database.

    Now when I go to the server's URL in a browser, I get the database connection error. I'm sure I'm missing an important step. Like I said: I'm new.

    Thanks in advance for your help.

  2. Pothi
    Posted 3 years ago #

    No, you didn't seem to have missed any important step. You seemed to have done everything right. Please try to have a look at the other related questions asked previously. As you are using linux, please check, if you can connect via command line using the credentials supplied (mysql -h localhost -u wordpress -p 'thepassword' databasename). Sometimes, a typo can cause this error.

Topic Closed

This topic has been closed to new replies.

About this Topic