Title: Error establishing a database connection
Last modified: August 19, 2016

---

# Error establishing a database connection

 *  [dirkg](https://wordpress.org/support/users/dirkg/)
 * (@dirkg)
 * [18 years ago](https://wordpress.org/support/topic/error-establishing-a-database-connection-42/)
 * I have searched and found similar posts but without a solution to my particular
   problem.
    I have several domains with wordpress installed fine and running smoothly.
   A couple of days ago I decided to install 2.5 on another domain on the same server
   but got the above error saying my password or username was wrong or my database
   wasnt running. Well all my other installs are running fine, but I noticed the
   database was not being filled with anything. Eventually I gave up and just went
   to cpanel to install 2.3 which is what I have running on the other domains. Well
   I get the same error, but cpanel creates the database, username and password 
   so I know those are right. Plus this database is filled with the normal wp_ stuff.
   I am at wits end. Cpanel should have no troubles installing the software, I should
   have had no troubles installing the software. That error message is very expanitory
   soI should be able to fix it but cant. Nothing seems to be wrong in my opinion
   but wordpress wont run. Has this happened before and what might I do to fix it?

Viewing 5 replies - 1 through 5 (of 5 total)

 *  Thread Starter [dirkg](https://wordpress.org/support/users/dirkg/)
 * (@dirkg)
 * [18 years ago](https://wordpress.org/support/topic/error-establishing-a-database-connection-42/#post-740701)
 * [http://dev.mysql.com/doc/refman/4.1/en/old-client.html](http://dev.mysql.com/doc/refman/4.1/en/old-client.html)
 * That seems to tell me something about passwords not being compatible since I 
   have 4.1.22 and not all my installs use the new password configuration.
    I dont
   know, its late. Maybe that page will make since tomorrow. I just hate to do some
   of whats on that page and mess up all my other programs. Most importantly the
   program I have that I am not able to re-install sine the author disappeared and
   was the only one with the install for the $600 script.
 *  [kmessinger](https://wordpress.org/support/users/kmessinger/)
 * (@kmessinger)
 * [18 years ago](https://wordpress.org/support/topic/error-establishing-a-database-connection-42/#post-740728)
 * Go here [http://codex.wordpress.org/Installing_WordPress#Common_Installation_Problems](http://codex.wordpress.org/Installing_WordPress#Common_Installation_Problems)
   and scroll down to step 2.
 *  Thread Starter [dirkg](https://wordpress.org/support/users/dirkg/)
 * (@dirkg)
 * [18 years ago](https://wordpress.org/support/topic/error-establishing-a-database-connection-42/#post-740827)
 * This step 2?
 * >  Step 2: Create the Database and a User
   > If you are using a hosting provider, you may already have a WordPress database
   > set up for you, or there may be an automated setup solution to do so. Check
   > your hosting provider’s support pages or your control panel for clues about
   > whether or not you’ll need to create one manually.
   > If you determine that you’ll need to create one manually, follow the instructions
   > for accessing phpMyAdmin on various servers, or follow the instructions for
   > Using cPanel or Using phpMyAdmin below.
   > If you are installing WordPress on your own web server, follow the Using phpMyAdmin
   > or Using the MySQL Client instructions below to create your WordPress username
   > and database.
 * Because that is exacly what I did, both with Cpanel manually and with cpanels
   auto script install where it creates the database on install for you. Both methods
   have always worked. But not now, on any of my domains.
 *  [kmessinger](https://wordpress.org/support/users/kmessinger/)
 * (@kmessinger)
 * [18 years ago](https://wordpress.org/support/topic/error-establishing-a-database-connection-42/#post-740833)
 * Did you scroll further?
 * > Using cPanel
   >  Main article: Using cPanel
   > If your hosting provider uses cPanel, you may follow these instructions to 
   > create your WordPress username and database.
   > Log in to your cPanel.
   >  Click MySQL Databases. If a user relating to WordPress
   > does not already exist under the Users section, create one: Chose a username
   > for WordPress (‘wordpress’ is good) and enter it in the UserName field. Choose
   > a difficult-to-guess password (ideally containing a combination of upper- and
   > lower-case letters, numbers, and symbols), and enter it in the Password field.
   > Write down the username and password you chose. Click Add User. If a database
   > relating to WordPress does not already exist under the Databases section, create
   > one: Choose a name for your WordPress database (‘wordpress’ or ‘blog’ are good),
   > enter it in the Db field, and click Add Db. Under Databases, select your WordPress
   > username from the User dropdown, then select your WordPress database from the
   > Db dropdown. Make sure All is checked under Privileges, then click Add User
   > to Db. When you return to the main MySQL Account Maintenance screen, cPanel
   > will list information about the database you just created. You should see the
   > username you just added to the database (with ALL PRIVILEGES), as well as a
   > few sample Connection Strings for you to use in Perl or PHP scripts to connect
   > to the database. The PHP code will have the following format: $dbh = mysql_connect(“
   > hostname”, “username”, “<PASSWORD HERE>”) or die (“message”); mysql_select_db(“
   > databasename”); Write down the values of hostname, username, databasename, 
   > and the password you chose. (Note that hostname will usually be localhost.)
 * The error is common and very specific. Something is wrong with your wp-config
   file and/or something is wrong with your database.
 *  Thread Starter [dirkg](https://wordpress.org/support/users/dirkg/)
 * (@dirkg)
 * [18 years ago](https://wordpress.org/support/topic/error-establishing-a-database-connection-42/#post-740835)
 * Yes I saw that. I have installed WP 5 other times without problem and countless
   other cgi and php scripts which use mysql.
    I have also use fantasico and the
   cpanel installer to install other scripts over the last few days which have worked
   before but now do not install and give the same mysql error. Like I said I should
   be able to solve this specific error message within seconds, but cant. I have
   poored though my sever setup and config files to see if I mistakenly changed 
   something a couple of weeks ago when I shut off exim and pop for other reasons.
   They are both back on and running now and I have seen no other problems in my
   configurations.

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘Error establishing a database connection’ is closed to new replies.

 * In: [Installing WordPress](https://wordpress.org/support/forum/installation/)
 * 5 replies
 * 2 participants
 * Last reply from: [dirkg](https://wordpress.org/support/users/dirkg/)
 * Last activity: [18 years ago](https://wordpress.org/support/topic/error-establishing-a-database-connection-42/#post-740835)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
