Title: Error DB connection
Last modified: August 20, 2016

---

# Error DB connection

 *  [jupiter2005ster](https://wordpress.org/support/users/jupiter2005ster/)
 * (@jupiter2005ster)
 * [13 years, 10 months ago](https://wordpress.org/support/topic/error-db-connection/)
 * Hello all,
 * I’ve got an Apache with PHP (supported versions – PHP 5.2.17, Apache 2.2.22 –
   and working properly). I downloaded wordpress 3.3.2 version, extracted, copy 
   under Apache.
    I filed in properly the ‘wp-config.php’. I tried open [http://localhost/wordpress/wp-admin/install.php](http://localhost/wordpress/wp-admin/install.php)
   and I got an error message: ———————————————— 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 127.0.0.1:3306.
   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? ————————————————- I’m sure the mysql is run, I can connect to wordperss
   db. I wrote a sort php code:
 *     ```
       <?php
       $kapcsolat = mysql_connect ( "localhost", "wordpress", "VerySecretPass");
       if (! $kapcsolat) {
         die ("mysql connect error");
       }
       else {
         echo "mysql connect OK";
       }
       ?>
       ```
   
 * I tried to insert in ‘wp-db.php’ file like:
    ————————————————
 *     ```
       function db_connect() {
   
       		$this->is_mysql = true;
   
       		if ( WP_DEBUG ) {
       $this->dbh = mysql_connect( $this->dbhost, $this->dbuser, $this->dbpassword, true );
       		   } else {
       $this->dbh = mysql_connect( "localhost", "wordpress", "VerySecurePass", true );
       		}
       ```
   
 * ————————————————
    and it works. The install page appears correctly but I didn’t
   do anything. I don’t know what the basic problem is and what will happen, if 
   I follow the install. Could anyone help me?
 * Thank you,
    jupiter2005ster

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

 *  Thread Starter [jupiter2005ster](https://wordpress.org/support/users/jupiter2005ster/)
 * (@jupiter2005ster)
 * [13 years, 10 months ago](https://wordpress.org/support/topic/error-db-connection/#post-2798554)
 * Does anybody have a clue? Where can I find the failure? How can I fix it?
    Can
   improve the debugging level?
 *  [RichardWPG](https://wordpress.org/support/users/richardwpg/)
 * (@richardwpg)
 * [13 years, 10 months ago](https://wordpress.org/support/topic/error-db-connection/#post-2798555)
 * – First, try contacting the hosting provider if the database server is online/
   if they have any other problem at their end, or they made any changes to your
   account, or if there are any limitations/restrictions, if the hosting package
   is set to Windows and not Linux, etc .
    – double check your wp-config.php file
   settings for the database name, database username and database password. This
   is where most errors occur. -Then check that you don’t need to change the database
   host from “localhost” to something else. You can get that info from your hosting
   provider. – Check you have actually created a database with the same database
   name as is in your wp-config.php file. – Last, but not least, if all that information
   is correct your database probably has a problem with it, and you may need to 
   contact your hosting provider.
 *  Thread Starter [jupiter2005ster](https://wordpress.org/support/users/jupiter2005ster/)
 * (@jupiter2005ster)
 * [13 years, 10 months ago](https://wordpress.org/support/topic/error-db-connection/#post-2798624)
 * I checked my wp-config.php. I’m sure the settings are good.
    I set only (DB –
   name, user, password, host, charset, collate -). Do I need another? I run LAMP
   on localhost (I have a win7). All services run.

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

The topic ‘Error DB connection’ is closed to new replies.

## Tags

 * [database connection](https://wordpress.org/support/topic-tag/database-connection/)
 * [mysql_connect](https://wordpress.org/support/topic-tag/mysql_connect/)
 * [wp-db.php](https://wordpress.org/support/topic-tag/wp-db-php/)

 * In: [Installing WordPress](https://wordpress.org/support/forum/installation/)
 * 3 replies
 * 2 participants
 * Last reply from: [jupiter2005ster](https://wordpress.org/support/users/jupiter2005ster/)
 * Last activity: [13 years, 10 months ago](https://wordpress.org/support/topic/error-db-connection/#post-2798624)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
