Title: Cannot Connect to database
Last modified: August 19, 2016

---

# Cannot Connect to database

 *  [vaujanolo](https://wordpress.org/support/users/vaujanolo/)
 * (@vaujanolo)
 * [15 years, 11 months ago](https://wordpress.org/support/topic/cannot-connect-to-database-3/)
 * I can see this had been covered before but I haqve spent the last six hours trying
   to resolve this and cannot get anywhere:
 * 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 localhost. 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?
 * My settings are:
    define(‘DB_NAME’, ‘mynews’); // The name of the database define(‘
   DB_USER’, ‘mynews’); // Your MySQL username define(‘DB_PASSWORD’, ‘Kup9xagu’);//…
   and password define(‘DB_HOST’, ‘localhost’); // 99% chance you won’t need to 
   change this value define(‘DB_CHARSET’, ‘utf8’); define(‘DB_COLLATE’, ”);
 * If I connect to the MYSQL database using mysql from the command line with these
   settings, all is well. This indicates that the username, password and host are
   all correct. Why then, will WordPress not connect?
 * Any help most appreciated.

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

 *  [sanypoo](https://wordpress.org/support/users/sanypoo/)
 * (@sanypoo)
 * [15 years, 11 months ago](https://wordpress.org/support/topic/cannot-connect-to-database-3/#post-1585759)
 * have you Rename the wp-config-sample.php file to wp-config.php.?
    [http://codex.wordpress.org/Installing_WordPress](http://codex.wordpress.org/Installing_WordPress)
 *  Thread Starter [vaujanolo](https://wordpress.org/support/users/vaujanolo/)
 * (@vaujanolo)
 * [15 years, 11 months ago](https://wordpress.org/support/topic/cannot-connect-to-database-3/#post-1585762)
 * Yes, the info above was from the config file.
 * I am actually moving an existing WordPress install from my ISP to my own Mac 
   OSX Server. I have got the MYSQL database running, I just can’t get it to talk
   to WordPress.
 *  [Mark Ratledge](https://wordpress.org/support/users/songdogtech/)
 * (@songdogtech)
 * [15 years, 11 months ago](https://wordpress.org/support/topic/cannot-connect-to-database-3/#post-1585808)
 * Have you used [phpMyAdmin](http://www.phpmyadmin.net/home_page/index.php) to 
   make a database or made a database via terminal and Mysql?
 *  Thread Starter [vaujanolo](https://wordpress.org/support/users/vaujanolo/)
 * (@vaujanolo)
 * [15 years, 11 months ago](https://wordpress.org/support/topic/cannot-connect-to-database-3/#post-1585918)
 * I used phpmyadmin.
 * I managed to login to the database using the terminal to check the username and
   password.
 * Any ideas?
 *  [Mark Ratledge](https://wordpress.org/support/users/songdogtech/)
 * (@songdogtech)
 * [15 years, 11 months ago](https://wordpress.org/support/topic/cannot-connect-to-database-3/#post-1585925)
 * Sure the mysql username is not root, which is typical in OS X? Check and check
   again.
 * [http://damonparker.org/blog/2005/09/06/reset-root-mysql-password/](http://damonparker.org/blog/2005/09/06/reset-root-mysql-password/)
 *  Thread Starter [vaujanolo](https://wordpress.org/support/users/vaujanolo/)
 * (@vaujanolo)
 * [15 years, 11 months ago](https://wordpress.org/support/topic/cannot-connect-to-database-3/#post-1585934)
 * Yes, I can login via the terminal by doing:
 *  mysql -h localhost -u mynews -p
 * and putting the password in. This shows my username and password are correct.
 * Thanks for your help though. Any other suggestions?
 *  [bragggf](https://wordpress.org/support/users/bragggf/)
 * (@bragggf)
 * [15 years, 11 months ago](https://wordpress.org/support/topic/cannot-connect-to-database-3/#post-1585947)
 * I am having the same issue. I am using a remote MySQL database running on a solaris
   box that is already supporting other wordpress databases. However on my local
   install I am unable to establish/maintain a php connection. This is not a user/
   password/database/host permissions issue. Something amiss between php and mysql:
 * running a php-mysql connection test returns the following:
 * Lost connection to MySQL server at ‘reading initial communication packet’, system
   error: 146
 * Believe the remote MySQL version is 5.1.46
 *  [luisbonie](https://wordpress.org/support/users/luisbonie/)
 * (@luisbonie)
 * [15 years, 1 month ago](https://wordpress.org/support/topic/cannot-connect-to-database-3/#post-1586055)
 * If you have changed your database password you need to also change it in your
   wp-config file…
 * /** MySQL database password */
    define(‘DB_PASSWORD’, ‘Change It Here’);
 * I hope this is your solution :]
 *  [shinshugita](https://wordpress.org/support/users/shinshugita/)
 * (@shinshugita)
 * [15 years, 1 month ago](https://wordpress.org/support/topic/cannot-connect-to-database-3/#post-1586056)
 * set host to 127.0.0.1 instead of localhost.

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

The topic ‘Cannot Connect to database’ is closed to new replies.

## Tags

 * [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/)
 * 9 replies
 * 6 participants
 * Last reply from: [shinshugita](https://wordpress.org/support/users/shinshugita/)
 * Last activity: [15 years, 1 month ago](https://wordpress.org/support/topic/cannot-connect-to-database-3/#post-1586056)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
