Trying to install WordPress on WSL Windows 10, and running into issues with wp-cli and “wp db create”

The error has nothing to do with your setup. It says that your connection credential to MySQL database is incorrect.

ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)

When you were setting up the MySQL by following the tutorial

sudo apt install -y lamp-server^

It probably did ask you to set a password for MySQL. So you should replace passwordhere with the password you have set during the installation process.

wp config create --dbname=jackalope --dbhost=localhost --dbuser=root --dbpass=put-your-password-here-the-one-you-set-during-installation-process

If it doesn’t work you can try with your virtual machine password or root

wp config create --dbname=jackalope --dbhost=localhost --dbuser=root --dbpass=root

Note: However, if you are pretty sure the password is correct, try replace localhost with 127.0.0.1

Leave a Comment