• Hi guys, I am trying to set up wordpress locally but am getting the following

    “We were able to connect to the database server (which means your username and password is okay) but not able to select the wp database.

    Are you sure it exists?
    Does the user root have permission to use the wp database?
    On some systems the name of your database is prefixed with your username, so it would be like username_wp. Could that be the problem?
    If you don’t know how to set up a database you should contact your host. If all else fails you may find help at the WordPress Support Forums.”

    This is my config file
    define(‘DB_NAME’, ‘wp’);

    /** MySQL database username */
    define(‘DB_USER’, ‘root’);

    /** MySQL database password */
    define(‘DB_PASSWORD’, ”);

    /** MySQL hostname */
    define(‘DB_HOST’, ‘localhost’);

    /** Database Charset to use in creating database tables. */
    define(‘DB_CHARSET’, ‘utf8’);

    I have created a database in phpmyadmin with exactly the name of wp and the root user has privleges and access to this database so I’m not sure the problem is

Viewing 9 replies - 16 through 24 (of 24 total)
  • Moderator Samuel Wood (Otto)

    (@otto42)

    www.ads-software.com Admin

    Okay, let’s try a different approach.

    You have an AMP install locally, and mysql running. Great.

    Find the MySQL binary on your machine, and open up a command shell. Type this:

    mysql -u root -h localhost

    That will start the mysql client connected to your localhost, using root with no password.

    Type this command to list the databases (note the semicolon is required):

    show databases;

    That will print a list of your databases. Now try this one:

    use lep;

    If what you’re stating so far is accurate, you should get an error somewhere along that path, because that is basically all that WordPress is doing. That “use database-name” is what WP does to connect to that database. Simple.

    Thread Starter a22mu

    (@a22mu)

    I get the following error when I try the “show databases;” in the mysql console:

    “ERROR 1064 (42000): You have an error in your SQL syntax…”

    Moderator Samuel Wood (Otto)

    (@otto42)

    www.ads-software.com Admin

    That.. makes no sense. Remove and reinstall.

    Thread Starter a22mu

    (@a22mu)

    Remove and reinstall what? WAMP?

    I don’t want to do that since I’ve already been working on my wp site using the ‘test’ database

    Moderator Samuel Wood (Otto)

    (@otto42)

    www.ads-software.com Admin

    Okay, the problem is that “show databases;” can’t give you a syntax error. It’s a built in command to MySQL.

    https://dev.mysql.com/doc/refman/5.7/en/show-databases.html

    Did you type it incorrectly or something?

    I had the same problem (database connection error) and I named the installation “famous 3 hours install” ??

    The problem was with the database user. Using phpMyAdmin default host for new user is “%” that is, any host. Change this to localhost and everything works fine now.

    Perhaps this shall be emphasized in WP installation guide.

    I got the same error message (Can’t select database) and found this old thread.

    The database has to be created. OK.
    Then the user has to be created. OK.
    The user needs the privileges to select the database and to create tables.

    Wrong:
    grant usage on *.* to user_XXX@localhost identified by ‘XXXXXXXX’;
    Correct:
    GRANT ALL PRIVILEGES ON wordpress_db_XXXX.* TO ‘user_XXX’@’localhost’ identified by ‘XXXXX’;

    Please close this thread.

    This thread is for a LOCAL install if anybody bothered to read the OP. Also, these forums are not for complaints, we have social media and other platforms for that. These forums are for support, all of which is provided by volunteers.

    The last couple of posts are incorrect and for the record, WordPress can actually be installed as fast as 60 seconds on a properly configured localhost. I know because that’s how long it takes me on my development machine (PC).

    And if you are installing on localhost for temporary development purposes, just use test as database, root as user, and leave the password blank. done.

    I accidentally delete MySQL database from cPanel. Is it possible to recover deleted MySQL database files? My WordPress is also not working due to this reason…
    Help me, please.

Viewing 9 replies - 16 through 24 (of 24 total)
  • The topic ‘Can't select database’ is closed to new replies.