snakespan
By:
snakespan

Unable to create user in SQL

January 10, 2017 467 views
MySQL WordPress Ubuntu 16.04

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?

2 Answers

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).

A "LAMP" stack is a group of open source software that is typically installed together to enable a server to host dynamic websites and web apps. This term is actually an acronym which represents the Linux operating system, with the Apache web server. The site data is...

@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;
Have another answer? Share your knowledge.