Can't select database - Wordpress Can't select database - Wordpress wordpress wordpress

Can't select database - Wordpress


Please don't overcomplicate.

In the "Database Host" field add "localhost: e.g. in my case "localhost:3308" solved the problem.


For anyone who's still looking for solutions to this problem - please, check again your wp-config.php database credentials again. I had the same problem today and tried to over-complicate the matter by searching for advanced solutions, while I had a space in my DB_NAME field (was supposed to be 'wpdb' and was ' wpdb').

This space completely messed up my connection, I was even close to reinstalling the whole thing and losing all data.


If using LAMP -

Make sure that all privileges are granted for that database to the created mysql user. Under your MYSQL shell use the below

GRANT ALL PRIVILEGES ON database_name.* TO database_user@localhost IDENTIFIED BY 'user_password';

Where,

database_name = your database name as per wp-config.php

database_user = your user name as per wp-config.php

userpassword = your user password as per wp-config.php