• I tried to use wp-install.php and this came up. I created a database and all, and put the name of the database and the username and password in the config file. I don’t understand why it’s not working!!
    SQL/DB Error —
    [
    Error establishing a database connection!
    Are you sure you have the correct user/password?
    Are you sure that you have typed the correct hostname?
    Are you sure that the database server is running?
    ]
    SQL/DB Error —
    [
    Error selecting database wordpress!
    Are you sure it exists?
    Are you sure there is a valid database connection?
    ]

Viewing 11 replies - 1 through 11 (of 11 total)
  • Thread Starter Anonymous

    Oh, wow. Just fixed it. Never mind!

    Thread Starter Anonymous

    So how’d you fix it?
    Thanks,
    Keith

    I’m encountering the same problem, and my wp-config.php is set corretly. Why I proceed to the next screen by clicking: “Let’s go”, I’m getting “DB Error, could not list tables MySQL Error: Access denied for user: ‘@localhost’ to database ‘db_wordpress'”. Can you help me please? I don’t understand what user: ‘@localhost’ mean. My user I’m connecting with has another name. On my local machine, everything works perfect, but when I uploaded it to my webhost, I’m not able to access the database. Any hints appreciated.
    Thank you,
    Soso

    localhost points to the server. the text before @ sign is the username…
    since its coming blank, you dont seem to have specified the username for the database in question in the config file…

    Sushubh, thanks for the hint, but I specified the user in the wp-config.php. And the user actually exist, I created it manualy through the CPanel…

    define(‘DB_NAME’, ‘databasename’); // The name of the database
    define(‘DB_USER’, ‘username’); // Your MySQL username
    define(‘DB_PASSWORD’, ‘password’); // …and password
    define(‘DB_HOST’, ‘localhost’); // 99% chance you won’t need to change this value
    Though you have mentioned it, just wanted to confirm if these values are substituted.
    99% chance your database is not linked to the username u made. I think you need to link the database with the user you created…
    Maybe someone else with better database knowledge will chip in…

    Thread Starter Anonymous

    If there were documentation on such a thing, this would be good to have in it.
    How to create the database.
    <pre>
    % head wp-config.php
    <?php
    /** WordPress’s config file **/
    // ** MySQL settings **
    define(‘DB_NAME’, ‘wp_db’); // The name of the database
    define(‘DB_USER’, ‘wp_db_user’); // Your MySQL username
    define(‘DB_PASSWORD’, ‘obscure’); // …and password
    define(‘DB_HOST’, ‘localhost’); // 99% chance you won’t need to change this value
    % mysql -u root -p mysql
    Enter password:
    Reading table information for completion of table and column names
    You can turn off this feature to get a quicker startup with -A
    Welcome to the MySQL monitor. Commands end with ; or \g.
    Your MySQL connection id is 3 to server version: 4.0.16-standard
    Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the buffer.
    mysql> CREATE DATABASE wp_db;
    Query OK, 1 row affected (0.05 sec)
    mysql> GRANT ALL PRIVILEGES ON wp_db.* to wp_db_user@localhost IDENTIFIED BY ‘obscure’;
    Query OK, 0 rows affected (0.04 sec)
    mysql> FLUSH PRIVILEGES;
    Query OK, 0 rows affected (0.01 sec)
    mysql> exit
    Bye
    %
    </pre>
    Also, this may have been obvious to everyone but me, but you have to open your readme (and *.php files!) via your webserver – not as a local file. In otherwords, use http://localhost/wordpress/readme.html instead of file:///usr/local/apache2/htdocs/wordpress/readme.html. This will make sure all of your php commands are processed before hitting your browser.
    Keith

    Thread Starter Anonymous

    i have the same problem, can anyone tell me what should be change on the wp-config.php and any iother change needed to make except this ?

    I’ve got a cool little hack in my wp-config (and some additional checks in index.php, and minor options settings in my local SQL wp_options table) to differentiate between my local WP and my net-hosted WP.
    In config, I do the following:
    // ** MySQL settings **
    define(‘DB_NAME’, ‘db’); // The name of the database
    define(‘DB_USER’, ‘usr’); // Your MySQL username
    define(‘DB_PASSWORD’, ‘pw’); // …and password
    // CDN customization — allows full uploading of files, but local runtime settings.
    if ($_SERVER[‘SERVER_NAME’]==’your.apache.servername’ /*|| $_SERVER[‘SERVER_ADDR’ =’127.0.0.1’*/) // test for your local test apache server…
    define(‘DB_HOST’, ‘localhost:’);
    else
    define(‘DB_HOST’, ‘128.121.4.19’);
    That’s a great approach to start with.
    Then, make sure that your apache server name variable is set to match, and that your local db wp_options has all the site-url fields pointing to something local rather than your remote WP install. For instance, I have a dyndns.org domain name set up, so I set that in all my site urls in my local wp_options, so that I can do pretty much everything (other than admin stuff) locally right now, then just ftp everything to the net and it works.
    Note that in config, I also do:
    $on_test_server = ($server==’localhost:’);
    … which I can then test inside index.php for what to specially display when I’m testing here. For example, instead of calling/echoing my statcounter tracking, I just echo “CHAITGEAR @ HOME”. I also change the page title to say “@ HOME” in it, so I can quickly see from the window titlebar which version I’m working with. Grab my index.php off of http://www.chait.net if you want to see exact usage.
    =d

    Thread Starter Anonymous

    I’ve been getting the same error message. I emailed my web host and they said that I must use 127.0.0.1 to connect to the mysql server. No idea what that means.

    Anon – use that instead of ‘localhost’ in wp-config.php

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

The topic ‘MySQL DB error’ is closed to new replies.