It seems, that this is a question that regularly shows up in forums or stackoverflow.
To start, let’s highlight the fact that in MySQL 8.0 it’s
not any more possible to create a user directly
from the GRANT command (
ERROR 1410 (42000):
You are not allowed to create a user with GRANT).
This means that to grant some privileges, the user must be created first.
Let’s create a user ‘user1‘ with ‘ChangeMe‘ as password that the user will have to change:
mysql> create user 'user1' identified by 'ChangeMe' password expire;
Query OK, 0 rows affected (1.35 sec)
Let’s try to connect to MySQL using that new created user:
$ mysql -u …[Read more]