• We haev no success in connecting to the mySQL database at our host. Have edited the wp_config file but still not luck.

    We have placed the WP files on a sub-domain to our main domain.

    Below the wp config file as it reads today;

    <?php
    // ** MySQL settings ** //
    define('DB_NAME', 'w8u7uuje_blog');    // The name of the database
    define('DB_USER', 'w8u7uuje_mari');     // Your MySQL username
    define('DB_PASSWORD', 'xxxxxxx'); // ...and password
    define('DB_HOST', 'localhost');    // 99% chance you won't need to change this value
    define('DB_CHARSET', 'utf8');
    define('DB_COLLATE', '');
    
    // You can have multiple installations in one database if you give each a unique prefix
    $table_prefix  = 'wp_';   // Only numbers, letters, and underscores please!
    
    // Change this to localize WordPress.  A corresponding MO file for the
    // chosen language must be installed to wp-content/languages.
    // For example, install de.mo to wp-content/languages and set WPLANG to 'de'
    // to enable German language support.
    define ('WPLANG', '');
    
    /* That's all, stop editing! Happy blogging. */
    
    define('ABSPATH', dirname(__FILE__).'/');
    require_once(ABSPATH.'wp-settings.php');
    ?>

    Can anyone help???

Viewing 12 replies - 1 through 12 (of 12 total)
  • I would insure that your mySQL server is in fact hosted on localhost. This is something your host can tell you.

    We haev no success in connecting to the mySQL database

    That’s not enough. Which error message do you get? (there are more than one)

    Thread Starter MandM

    (@mandm)

    Below is the entire 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 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?
    If you’re unsure what these terms mean you should probably contact your host. If you still need help you can always visit the WordPress Support Forums.

    And here is the information from our hosting service wrt location of the MySQL database:


    $dbh=mysql_connect (“localhost”, “w8u7uuje_mari”, “<PASSWORD HERE>”) or die (‘I cannot connect to the database because: ‘ . mysql_error());
    mysql_select_db (“w8u7uuje_wordpress”);

    We can also see the MySQL database using phpMyAdmin and create tables in it.

    I can’t see what I have done wrong in the wp_config file?

    marianne

    Please verify your database name

    As per your two postings

    define('DB_NAME', 'w8u7uuje_blog');

    and

    mysql_select_db ("w8u7uuje_wordpress");
    Thread Starter MandM

    (@mandm)

    Sorry about that – I changed the database name from ‘w8u7uuje_blog’ to ‘w8u7uuje_wordpress’ – the wp-config file is also updated with the last database name (‘w8u7uuje_wordpress’.

    I also followed the description in the WP blog on how to define a MySQL database and user and giving the user full access to the database. Everything done in the same sequence as decribed in the blog. It still doesn’t work.

    My webhotel isn’t too helpfull either – they don’t reply on their help desk…

    MandM – I had the same problem and was up all night trying to resolve it. I know exactly what you’re going through. Thank the goddess this blog was a ‘test’ blog of sorts and I hadn’t posted there in a while – because it appears gone with the wind. From what I can tell, version 2.3.1 erased access to my password in MySQL; I then needed to create a new user and password to try to access the site. That worked, but my database can’t be reached. I’m getting the same error messages as you, where there’s no logic in the lack of connection. I’ll be anxious to hear if anyone else had this problem…

    UPDATE: Ok, I resolved the problem. I created a new user and password in MySQL and gave it all privileges to the database. I changed the username and password in the wp-config.php file, and voila! It worked. So I deleted the former username and then went back and added it in again, but with a new password. I once again changed it in the wp-admin.php file. Voila! It worked again. I was able to then delete the second username and password I had created to get into the database in the first place.

    Now – to figure out why version 2.3 eliminated my link categories. Hopefully someone else had that problem as well…

    Hi,

    I have a similar problem. I tried multiple times checking the database, user id, password, etc.; but WP refuses to recognize the database!
    Any help would be greatly appreciated!

    Cheers..Surya

    See if this helps. When you create your database user, use:

    GRANT ALL PRIVILEGES ON *.* TO ‘username’@’%’
    IDENTIFIED BY ‘password’ WITH GRANT OPTION;

    Change username and password to your username and password.

    After several attempts with the same configuration, decided to do all over and bingo! its done…

    Thank you… Surya

    Thanks capsrock !!

    I had exactly the same problem. Also, i was installing on Windows, had never used MySQL before. Couldn’t make heads or tails of mySqlAdmin (it’s unhappy about something).

    Even so, I was able to create an ODBC link to MySQL, create the database and add the users. Your GRANT suggestion was the trick that got me over the hump.

    Thanks again.

    Not sure if this will be useful for anyone on here, but I had the same problem with a local install on my Mac. I eventually solved it by changing the DB_HOST to ‘127.0.0.1’ rather than ‘localhost’. If you go this route, I believe you will also need to add the user with that host name, like so:

    GRANT ALL PRIVILEGES ON databasename.* TO ‘username‘@’127.0.0.1’ IDENTIFIED BY ‘password‘ WITH GRANT OPTION;

    This worked. Hope it helps someone.

Viewing 12 replies - 1 through 12 (of 12 total)
  • The topic ‘Unable to connect to database’ is closed to new replies.