Title: Database connection problem
Last modified: August 18, 2016

---

# Database connection problem

 *  Resolved [redtruck](https://wordpress.org/support/users/redtruck/)
 * (@redtruck)
 * [20 years, 10 months ago](https://wordpress.org/support/topic/database-connection-problem-2/)
 * I had WordPress 1.5.1.1 installing with one click through cPanel on an Apache
   server, then it stopped working. After several efforts to find help on the cPanel
   forum, my hosting techs and this forum, I decided to start with a fresh install
   in a fresh hosting account. When run the wp-admin/install.php program, I get 
   the “Error establishing a database connection” error. My server is up. I’ve double-
   checked the database name, username, password, and the host name is “localhost.”
   PHP Version is 4.3.11, MySQL Version is 3.23.49, Zend Version is 2.5.7. Permissions
   for the 4 wp- folders is 755. Permissions for the files are 644. suexec is disabled.
   I don’t know what other information to give you. WP worked before on this server
   with one-click installs. Now it doesn’t work at all. MySQL is working for other
   applications I have on this server. If I need to check anything else on this 
   server, please give specific instructions. I really appreciate any help you can
   give me. Thanks, Bob

Viewing 15 replies - 1 through 15 (of 23 total)

1 [2](https://wordpress.org/support/topic/database-connection-problem-2/page/2/?output_format=md)
[→](https://wordpress.org/support/topic/database-connection-problem-2/page/2/?output_format=md)

 *  [Class](https://wordpress.org/support/users/class/)
 * (@class)
 * [20 years, 10 months ago](https://wordpress.org/support/topic/database-connection-problem-2/#post-235294)
 * Did you create the wp-config.php file? Edit it? What permissions does it have?
 *  [Mark (podz)](https://wordpress.org/support/users/podz/)
 * (@podz)
 * [20 years, 10 months ago](https://wordpress.org/support/topic/database-connection-problem-2/#post-235296)
 * ” then it stopped working”
    What did ? What did you see ?
 *  Thread Starter [redtruck](https://wordpress.org/support/users/redtruck/)
 * (@redtruck)
 * [20 years, 10 months ago](https://wordpress.org/support/topic/database-connection-problem-2/#post-235298)
 * To Class,
    Many thanks for responding. I edited the wp-config-sample.php file
   per the instructions as follows: define(‘DB_NAME’, ‘scrubsfi_wp1’); define(‘DB_USER’,‘
   scrubsfi_wp1’); define(‘DB_PASSWORD’, ‘**obscure**’); define(‘DB_HOST’, ‘localhost’);
   being careful not to delete any punctuation. I’ve checked the names to be sure
   they are the same as are indicated in the MySQL section of my cPanel. Then I 
   changed the file name to wp-config.php . It’s permissions are 644.
 * If you need access to the cPanel of this hosting account to help further, I can
   provide access information. I need to know what steps you take to resolve the
   problem as I have another account to correct.
 * Thanks again, Bob
 *  [Class](https://wordpress.org/support/users/class/)
 * (@class)
 * [20 years, 10 months ago](https://wordpress.org/support/topic/database-connection-problem-2/#post-235299)
 * Hmm, do you have shell access? If so, could you try a “mysql -u scrubsfi_wp1 -
   p” ?
    I’m kinda lost without a shell prompt 🙂
 * Does db scrubsfi_wp1 exist? From the previous working WP?
    Do you have access
   to db and http error logs?
 *  Thread Starter [redtruck](https://wordpress.org/support/users/redtruck/)
 * (@redtruck)
 * [20 years, 10 months ago](https://wordpress.org/support/topic/database-connection-problem-2/#post-235300)
 * To podz,
    Many thanks to you for your response as well. When I said “then it 
   stopped working” I was referring to the one-click installation through my cPanel.
   I had to reinstall WP so I deleted the hosting account, then created the hosting
   account again and attempted the one-click installation process through my cPanel
   as before. The resulting page says this: “WordPress 1.5 Setup We are installing
   in /home/username/public_html/blog… Moving installation files into place…Done
   Setting up config file…Done Finishing installation steps…Done Installation Finished
   To access your WordPress installation go to: [http://domain.com/blog/](http://domain.com/blog/)
   To access the admin area of your WordPress installation go to: [http://domain.com.com/blog/wp-admin/](http://domain.com.com/blog/wp-admin/)
   The default randomly generated username and password are: Username: Password:
 * BTW, the actual version installed through this one-click process was 1.5.1.1.
   
   The exceptions I noted were: 1. The wp-config.php was not present or setup with
   database info as reported. An unedited wp-config-sample.php was in the /blog 
   folder but not the correct and complete wp-config.php as before. 2. The MySQL
   database, user and password were not setup as before. 3. No “default randomly
   generated username and password” was not provided as before.
 * I tried creating a new MySQL database with a new user and password, editing this
   information into the wp-config-sample.php, renaming it to wp-config.php, then
   running the wp-admin/install.php but this resulted in the same “Error establishing
   a database connection” message.
 * So I deleted the blog folder, downloaded ver 1.5.1.3 from this site, uploaded
   it to my site, edited and renamed the wp-config.php and got the same result: 
   Error establishing a database connection.
 * As I mentioned, I have another application in a different domain on this server
   where MySQL databases are running just fine. So I believe MySQL is running okay
   on this server. If there’s some other way for me to test whether MySQL is connecting
   in this domain, or if I can provide any other info, please let me know.
 * Thanks for your help, Bob
 *  [Mark (podz)](https://wordpress.org/support/users/podz/)
 * (@podz)
 * [20 years, 10 months ago](https://wordpress.org/support/topic/database-connection-problem-2/#post-235301)
 * [http://www.tamba2.org.uk/wordpress/](http://www.tamba2.org.uk/wordpress/)
    If
   you use CPanel / vDeck or Plesk, there are 3 guides on that page. If you use 
   something else, tell us what it is and we should be able to sort it.
 * It’s very probably just one button that needs clicking.
 *  Thread Starter [redtruck](https://wordpress.org/support/users/redtruck/)
 * (@redtruck)
 * [20 years, 10 months ago](https://wordpress.org/support/topic/database-connection-problem-2/#post-235302)
 * Hi Class, If you’re not on the other side of the world from me, you’re up awful
   late. Thanks for such a quick response.
 * 1. Shell Access. I have shell access through root. But when I tried to setup 
   the MySQL databases through the shell, it rejected my root password and expected
   a master MySQL password which I don’t have. I’ll request from my host.
 * 2. “Does db scrubsfi_wp1 exist?” Yes. After the I got the “Error establishing
   a database connection” I’ve deleted the blog folder, left the databases intact,
   downloaded ver 1.5.1.3 from this site, uploaded it to my site, edited and renamed
   the wp-config.php and got the same result. Then I also tried deleted the hosting
   account, then created the hosting account again, setting up the MySQL databases
   fresh through the cPanel, uploading 1.5.1.3, editing and renaming wp-config-sample.
   php and I still get the same result.
 * Do you know how I can find the master MySQL password for this server (it is mine,
   albeit hosted offsite) with root access?
 * Do you know if there is any problem to my changing the MySQL password for this
   server (which I believe I can do through my WebHostingManager access), in which
   case I would know the password and be able to carry out your shell command. Or
   would this disrupt other MySQL applications running on this server?
 * 3. “Do you have access to db and http error logs?” With shell access through 
   root, I’m sure I do but I don’t know what I’m looking at or looking for. I know
   just enough to be dangerous. But I follow instructions well. Sorry.
    <8^)
 * Thanks, Bob
 *  Thread Starter [redtruck](https://wordpress.org/support/users/redtruck/)
 * (@redtruck)
 * [20 years, 10 months ago](https://wordpress.org/support/topic/database-connection-problem-2/#post-235304)
 * Thanks for the Tamba2 link. I was following those exact instructions. However,
   your direction on confirming “localhost” led me to look more closely at the connection
   string for PHP. I put this string in a copy of index.php and called it with my
   browser and got this mysql_error message: “Client does not support authentication
   protocol requested by server; consider upgrading MySQL client”.
 * A further search on Google rendered information at: [http://dev.mysql.com/doc/mysql/en/old-client.html](http://dev.mysql.com/doc/mysql/en/old-client.html)
   which relates to versions of PHP, MySQL and client libraries and starts to point
   back to potential problems with my server. While I’m sure my other MySQL driven
   applications are working, I’ll address this to my hosting techs and report back
   anything I find out. Bob
 *  [scarfy007](https://wordpress.org/support/users/scarfy007/)
 * (@scarfy007)
 * [20 years, 10 months ago](https://wordpress.org/support/topic/database-connection-problem-2/#post-235306)
 * This exact thing happened to me thirty seconds ago. Now I can’t get the database
   to connect. I’m confident the database names are correct and my config.php is
   edited properly. I can’t believe it but this is my exact problem step for step.
   Have you found anything out?
 *  [Mark (podz)](https://wordpress.org/support/users/podz/)
 * (@podz)
 * [20 years, 10 months ago](https://wordpress.org/support/topic/database-connection-problem-2/#post-235307)
 * If your blog was working, and you’ve changed nothing, but you then see a database
   connection error, don’t worry.
 * Your host will have caused this, and it can occur for a number of reasons. Give
   it 15 minutes, after that, email your host asking them what is happening on the
   server. Server maintenance / upgrading can all cause this temporary blip and 
   it’s not a WP fault.
    It also happens to pretty much everyone at some stage 🙂
 *  [scarfy007](https://wordpress.org/support/users/scarfy007/)
 * (@scarfy007)
 * [20 years, 10 months ago](https://wordpress.org/support/topic/database-connection-problem-2/#post-235310)
 * Thanks for the quick response! I will chill for a bit… glad its nothing I did.
 *  Thread Starter [redtruck](https://wordpress.org/support/users/redtruck/)
 * (@redtruck)
 * [20 years, 10 months ago](https://wordpress.org/support/topic/database-connection-problem-2/#post-235381)
 * Hi All,
 * I don’t know where to suggest that this be made sticky or put in the FAQ or what,
   but it boils down to this: Failure to connect to the MySQL database isn’t always
   a user typing problem. So if you are absolutely certain that:
    1. you set up 
   your MySQL database correctly 2. you set up your MySQL user and password correctly
   3. you added your MySQL user to your MySQL database correctly 4. you edited your
   wp-config.php to include your DB_name, DB_user, DB_password and DB_host correctly
 * and still, when you attempt to run the install.php program, you get the dreaded“
   Error establishing a database connection,” go directly to your host and tell 
   them you’re not able to connect to a simple MySQL database with a simple PHP 
   program.
 * If they point to WordPress and declare that they’re not responsible for making
   WordPress work, if you’re using cPanel, go back to your cPanel, and click on 
   MySQL and look for the “connection strings. Copy the PHP connection strings into
   a text file and add some PHP stuff around it thusly:
 * `<?php 
    $dbh=mysql_connect ("<HOST NAME HERE>", "<USERNAME HERE>", "<PASSWORD
   HERE>") or die ('I cannot connect to the database because: ' . mysql_error());
   mysql_select_db ("<DB NAME HERE>");  ?>
 * The HOST NAME, USERNAME and DB NAME should already be filled in correctly from
   your cPanel/MySQL display. Fill in your PASSWORD where indicated. Then save this
   file as a PHP file with a name like mysql-test.php. Upload it to your hosting
   account. I’d suggest you put it in your “document root.” Then open your browser
   and go to: `http://www.yourdomainname.com/mysql-test.php`
    If you get an error
   message, take that to your host and say “This doesn’t have anything to do with
   WordPress, I can’t connect to a simple MySQL database on your server with a simple
   PHP program.” This takes WordPress out of the picture and gives your hosting 
   company a relevant error message to work with.
 * Further, if the error message is: “Client does not support authentication protocol
   requested by server; consider upgrading MySQL client.” refer your hosting company
   to:
    [http://dev.mysql.com/doc/mysql/en/old-client.html](http://dev.mysql.com/doc/mysql/en/old-client.html)
 * Hope this helps. Many thanks to all for their help. Bob
 *  [oleum](https://wordpress.org/support/users/oleum/)
 * (@oleum)
 * [20 years, 10 months ago](https://wordpress.org/support/topic/database-connection-problem-2/#post-235554)
 * redtruck,
 * I’m having a similar problem. I uploaded a test like the one above and I don’t
   get an error message (the root directory on my hosted account). WordPress still
   gives me an error message though its installed in a subdirectory. I’ve deleted
   the whole lot at the moment and am about to upload again. Anything else I can
   try if it still doesn’t work. I am considering binning the lot and using something
   else. I have an old b2 I could rework already installed if I have to.
 *  [Class](https://wordpress.org/support/users/class/)
 * (@class)
 * [20 years, 10 months ago](https://wordpress.org/support/topic/database-connection-problem-2/#post-235689)
 * What error message does WordPress give?
 *  [fundog5](https://wordpress.org/support/users/fundog5/)
 * (@fundog5)
 * [20 years, 9 months ago](https://wordpress.org/support/topic/database-connection-problem-2/#post-235718)
 * I am having the same problem, continually receiving the “Error establishing a
   database connection” message even though I’ve:
    1. confirmed the MySQL database
   name 2. confirmed the MySQL user name & privileges 3. confirmed the db user password
   was correct & verified MySQL was up & running properly through phpMyAdmin 3. 
   confirmed the db host name was correct, doubly verifying with my web account 
   host (websitesource.net) 4. ran a manual password reset via SQL 5. successfully
   run the simple “mysql-test.php” connection script from both the root directories
   and the subdirectory where I’m attempting to install WP 1.5.1.3
 * So I’m also totally stumped. What to do?
    (btw, my host runs MySQL 4.0.24 and
   PHP 4.3.11)

Viewing 15 replies - 1 through 15 (of 23 total)

1 [2](https://wordpress.org/support/topic/database-connection-problem-2/page/2/?output_format=md)
[→](https://wordpress.org/support/topic/database-connection-problem-2/page/2/?output_format=md)

The topic ‘Database connection problem’ is closed to new replies.

## Tags

 * [connection](https://wordpress.org/support/topic-tag/connection/)
 * [database](https://wordpress.org/support/topic-tag/database/)
 * [installation](https://wordpress.org/support/topic-tag/installation/)

 * In: [Installing WordPress](https://wordpress.org/support/forum/installation/)
 * 23 replies
 * 6 participants
 * Last reply from: [fundog5](https://wordpress.org/support/users/fundog5/)
 * Last activity: [20 years, 9 months ago](https://wordpress.org/support/topic/database-connection-problem-2/page/2/#post-235726)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
