mysql – Keep getting this error for wordpress database set-up on my pi? ERROR 1044 (42000): Access denied for user ‘pi’@’localhost’ to database ‘wordpress’

As I’m setting up my wordpress database I keep getting this error:

ERROR 1044 (42000): Access denied for user ‘pi’@’localhost’ to database ‘wordpress’

After typing this and entering my password:

sudo mysql -upi -p

I got this:

Welcome to the MariaDB monitor. Commands end with ; or g.

Your MariaDB connection id is 57

Server version: 10.3.27-MariaDB-0+deb10u1 Raspbian 10

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type ‘help;’ or ‘h’ for help. Type ‘c’ to clear the current input statement.

MariaDB ((none))>

And this was what I typed:

MariaDB ((none))> GRANT ALL PRIVILEGES ON wordpress.* TO 'pi'@'localhost' IDENTI FIED BY 'password';

I replaced the actual password with ‘password’ in this example for security reasons, but I tried all of the passwords that I had. Nothing worked. I keep getting the same error.

I also tried removing ‘pi’@’localhost’ and changing it to just ‘pi’. I also dropped and recreated the wordpress database and tried again. It’s always the same error.

Any suggestions? I have no clue where to continue from here.