Question

Unable to create user in SQL

Hi,

I’ve been following this tutorial to install Wordpress - https://www.digitalocean.com/community/tutorials/how-to-install-wordpress-with-lamp-on-ubuntu-16-04#step-1-create-a-mysql-database-and-user-for-wordpress

but this command seems to fail: GRANT ALL ON wordpress.* TO ‘wordpressuser’@‘localhost’ IDENTIFIED BY ‘password’;

with this error: ERROR 1819 (HY000): Your password does not satisfy the current policy requirements

I’ve tried a suggestion below with the following commands instead: mysql> CREATE USER ‘wordpressuser’; ERROR 1819 (HY000): Your password does not satisfy the current policy requirements mysql> ALTER USER ‘wordpressuser’@‘localhost’ IDENTIFIED BY ‘password’; ERROR 1396 (HY000): Operation ALTER USER failed for ‘wordpressuser’@‘localhost’

but those failed as well.

Any ideas?


Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

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.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

@snakespan

When MySQL was installed, the password strength plugin was most likely enabled and thus, weak passwords that do not pass the set policy will not be permitted for use.

For example, using a password such as xyz1234 won’t pass, but a password, such as the one shown below, should pass without issue:

E2M5Yk75rOD2P2G6zIECIYLPvcdJj1BcQWM9W2tRUpjBCIPBypebhTc0bLcOQbe

That’s not to say you need to use a password that long, it is, however, ideal. Given the technology and short amount of time it takes to crack short, non-random passwords, you should always use randomly generated passwords from a good source of entropy.

One good source is https://www.grc.com/passwords.htm.

The correct all-on-one command is indeed:

grant all on example_db.* to 'example_user'@'localhost' identified by 'strong_password';

… but you need to use a stronger, more secure password in combination with the command, else it’s going to fail.

You can, of course, uninstall the plugin using the command below (while logged in to the MySQL CLI), but instead, I’d simply recommend using a stronger password.

uninstall plugin validate_password;

ERROR 1819 (HY000): Your password does not satisfy the current policy requirements

Means that your password is not satisfying strength you selected on set up. I can assume that you followed LAMP tutorial before WordPress one. Important part is Install MySQL - VALIDATE PASSWORD PLUGIN. There you were asked for to validate password strength when creating new user or changing for existing user.

Policies are following:

There are three levels of password validation policy:

LOW    Length >= 8
MEDIUM Length >= 8, numeric, mixed case, and special characters
STRONG Length >= 8, numeric, mixed case, special characters and dictionary file

Please enter 0 = LOW, 1 = MEDIUM and 2 = STRONG: 1

If you selected 0 (LOW) on installation, try with password with at least 8 chars. For 1 (MEDIUM) passwords needs to be at least 8 chars long with letters (mixed case), numbers and special characters. For 2 (STRONG), 1 (MEDIUM) applies + dictionary check (you can’t use common words).