WordPress.org

Forums

Error establishing a database connection (10 posts)

  1. giantlocal
    Member
    Posted 8 years ago #

    I've edited my wp-config.php file correctly:

    <?php
    // ** MySQL settings ** //
    define('ewoky_blog', 'wordpress'); // The name of the database
    define('ewoky_martyn', 'username'); // Your MySQL username
    define('xxxxxxxx', 'password'); // ...and password
    define('DB_HOST', 'localhost'); // 99% chance you won't need to change this value

    ...and I get this:

    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?

    What am I doing wrong here? I've set up the database.

  2. chaaban
    Member
    Posted 8 years ago #

    Sometime the user name u set up is not the same ...

    go back to mysql and be sure the username is there .

    sometime a prefixe is added .. to the user u added .

  3. giantlocal
    Member
    Posted 8 years ago #

    It seems correct no?

    ewoky_blog

    Users in blog
    ewoky_martyn (Privileges: ALL PRIVILEGES)

    Connection Strings
    Perl $dbh = DBI->connect("DBI:mysql:ewoky_blog:localhost","ewoky_martyn","<PASSWORD HERE>");
    PHP $dbh=mysql_connect ("localhost", "ewoky_martyn", "<PASSWORD HERE>") or die ('I cannot connect to the database because: ' . mysql_error());
    mysql_select_db ("ewoky_blog");

  4. chaaban
    Member
    Posted 8 years ago #

    hehe no :)

    define('DB_NAME', 'db name here ');
    define('DB_USER', 'user name here');
    define('DB_PASSWORD', 'pass here');
    define('DB_HOST', 'localhost');

    u placed the pass and user in the wrong field :)

  5. giantlocal
    Member
    Posted 8 years ago #

    How so?

    WP-CONFIG.PHP :

    <?php
    // ** MySQL settings ** //
    define('ewoky_blog', 'wordpress'); // The name of the database
    define('ewoky_martyn', 'username'); // Your MySQL username
    define('xxxxxxxx', 'password'); // ...and password
    define('DB_HOST', 'localhost'); // 99% chance you won't need to change this value

    Seems correct to me, where is it wrong?

  6. chaaban
    Member
    Posted 8 years ago #

    define('DB_NAME', 'ewoky_blog');
    define('DB_USER', 'ewoky_martyn');
    define('DB_PASSWORD', 'xxxxxxx');
    define('DB_HOST', 'localhost');

    it should look like this .

  7. giantlocal
    Member
    Posted 8 years ago #

    THANK YOU.

  8. babycare
    Member
    Posted 8 years ago #

    ebuddy dont wont to work pleas help me

  9. chaaban
    Member
    Posted 8 years ago #

    what do you mean :|

  10. brandon206
    Member
    Posted 8 years ago #

    sometimes, as in my case, you need to change the 'localhost' to the IP address of your SQL server. That can throw the 'cannot connect' error. Check with your host.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.