It’s been years since I worked in web hosting - I’m sure the answer is super easy, but it’s late and my brain won’t grok anymore tonight:
Ok, so (obvious strings have been changed to protect, well, me):
CREATE DATABASE my_wp_db;
CREATE USER my_wp_db_un@localhost;
SET PASSWORD FOR my_wp_db_un@localhost= PASSWORD(“mycleverwppw”);
GRANT ALL PRIVILEGES ON wordpress.* TO my_wp_db_un@localhost IDENTIFIED BY ‘password’;
(or is it)
GRANT ALL PRIVILEGES ON wordpress.* TO my_wp_db_un@localhost IDENTIFIED BY ‘mycleverwppw’;
(I’ve tried it both ways)
FLUSH PRIVILEGES; EXIT
sudo nano ~/wordpress/wp-config.php
// ** MySQL settings - You can get this info from your web host ** // /** The name of the database for WordPress */ define(‘DB_NAME’, ‘my_wp_db’);
/** MySQL database username */ define(‘DB_USER’, ‘my_wp_db_un’);
/** MySQL database password */ define(‘DB_PASSWORD’, ‘mycleverwppw’);
/** MySQL hostname */ define(‘DB_HOST’, ‘localhost’);
Can’t select database
We were able to connect to the database server (which means your username and password is okay) but not able to select the my_wp_db database.
Are you sure it exists? Does the user my_wp_db_un have permission to use the my_wp_db database? On some systems the name of your database is prefixed with your username, so it would be like username_my_wp_db. Could that be the problem?
Do you guys see any notable syntax errors? Are there logs I could look at to help me? Any advice is welcome - thank you!
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.