• Like the countless other posts here and around the web, I’ve run into the Cannot select database wall.

    I’m doing a local install using XAMPP.

    • Apache is running
    • MySQL is running
    • The database wordpress has been created
    • Username root on localhost has ALL PRIVILEGES
    • There is a wp-config-sample.php file in the wordpress folder

    My specific error is this:

    Cannot select database

    The database server could be connected to (which means your username and password is okay) but the?database could not be selected.

    • Are you sure it exists?
    • Does the user root have permission to use the database?
    • On some systems the name of your database is prefixed with your username, so it would be like username_. Could that be the problem?

    To answer these 3 points:

    • The database exists
    • The user root has ALL PRIVILEGES
    • The database has no prefix. It’s “wordpress”

    I’ve read countless posts about this problem, none of the suggestions have worked. And a lot of them suggested renaming the wp-config-sample.php file to wp-config.php and entering my credentials, but the installer REQUIRES the sample file, not the completed file.

    This is my first local install and I’m a db noob, so any help is greatly appreciated!

Viewing 7 replies - 1 through 7 (of 7 total)
  • Hi WordPresskuma,
    1. Are you able to manage using this link https://localhost/phpmyadmin/ ?
    2. Are you able to visit website using https://localhost/wpprojectname/ your project url?

    Delete wp-config.php file and install from browser visit using https://localhost/wpprojectname/ url. Be confirm that you are providing DB_NAME, DB_USER, DB_PASSWORD, DB_HOST all the credentials correctly.

    Normally the credentials should be:
    ‘wordpress’,
    ‘root’,
    ‘ ‘, (empty)
    ‘localhost’

    Please try properly, hope it will work.
    Best regards,

    Two more tips:
    Check with XAMPP whether the database is actually running.
    Also check the Windows firewall. This could also be blocking the connection.

    Thread Starter wordpresskuma

    (@wordpresskuma)

    Thanks @ksthannan .

    I can access localhost/phpmyadmin and my project is simply localhost/wordpress at the moment as I can’t install WP.

    However, as I noted above, there is no wp-config file to delete or edit because I don’t get past the setup.

    I get to here: https://localhost/wordpress/wp-admin/setup-config.php, then choose my language, then I get to setup-config.php?step=1 and enter my info. Then I get the error page.

    The wp-config is still the wp-config-sample file. If I remove/rename it, I get an error during the installation that it is missing. ???♂?

    • This reply was modified 5 months, 4 weeks ago by wordpresskuma.
    Thread Starter wordpresskuma

    (@wordpresskuma)

    Thanks @threadi.

    The MySQL Module is running (Port 3307). However, the Service checkbox has a red X in it. Do I want that to be a green checkmark?

    Also, I looked at my firewall settings and mysqld.exe is allowed through. (There are no XAMPP files listed in the firewall settings.)

    Thread Starter wordpresskuma

    (@wordpresskuma)

    @threadi actually, I rebooted XAMPP and there are no red X’s under Service now. Under Module both Apache and MySQL are green and running.

    Thread Starter wordpresskuma

    (@wordpresskuma)

    Problem solved. I decided to read the readme.html doc in /wordpress. (What a concept!???♂?)

    And it says:

    1. Open wp-admin/install.php in your browser. It will take you through the process to set up a wp-config.php file with your database connection details.
      1. If for some reason this does not work, do not worry. It may not work on all web hosts. Open up wp-config-sample.php with a text editor like WordPad or similar and fill in your database connection details.
      2. Save the file as wp-config.php and upload it.
      3. Open wp-admin/install.php in your browser.

    The solution was as Abdul suggested, except that it can’t run from the installer page as that requires the wp-config-sample.php?file. You need to go to wordpress/wp-admin/install.php (rather than localhost/wordpress) in the browser. Then it goes straight to setup page for site name, etc.

    Thanks @ksthannan and @threadi for your time.

    @wordpresskuma?
    I followed your instructions and it worked.

Viewing 7 replies - 1 through 7 (of 7 total)
  • You must be logged in to reply to this topic.