When I download a new wordpress from wordpress.org and then paste it into my www folder of WAMP, then create a new database in phpmyadmin, then go to localhost and click the
Please don't overcomplicate.
In the "Database Host" field add "localhost: e.g. in my case "localhost:3308" solved the problem.
For me, the solution was giving wp_user
all permissions on the wp_db
database.
I achieved this using the command line interpreter (CLI):
$ mysql -uroot -p
MariaDB [(none)]> GRANT ALL ON `wp_db`.* TO `wp_user`@`localhost` IDENTIFIED BY 'pass';
MariaDB [(none)]> exit;
After these operations, I restarted the database:
$ systemctl restart mysql
Of course, the database name (wp_db), username (wp_user), and password of the user (pass) can be different.
I had this issue when trying to transfer databases between WAMP server installations.
I tried opening PhpMyAdmin on new PC, then got the port of MySql server (:3308) and added this port into DB_HOST ('localhost:3308')
. This worked for me.
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.
It sounds like either you have not created a database or your wp-config file is not set up correctly. Have you edited wp-config.php file of wordpress and provided correct database name and user credentials. See Famous 5 minute installation of wordpress for details.
For Mariadb hostname should be localhost:3306 and for MySQL localhost:3308.this fixed my error.