WordPress.org

Support

Support » Installation » Cannot Connect to database

Cannot Connect to database

  • 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)
  • have you Rename the wp-config-sample.php file to wp-config.php.?
    http://codex.wordpress.org/Installing_WordPress

    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.

    Moderator Mark Ratledge

    @songdogtech

    Forum Moderator

    Have you used phpMyAdmin to make a database or made a database via terminal and Mysql?

    I used phpmyadmin.

    I managed to login to the database using the terminal to check the username and password.

    Any ideas?

    Moderator Mark Ratledge

    @songdogtech

    Forum Moderator

    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/

    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?

    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

    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 :]

    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.
Skip to toolbar