docker container mysql authorize a new user

Problem Description:

After successfully running the mysql container, I entered mysql, and then we grant all privileges on *.* to 'reader' @'%' identified by '123456';created a new user to allow any ip to be able to access, but an error was reported.
Insert picture description here

Cause Analysis:

According to the query information, it is because mysql8 no longer supports one step, but it needs to be done in two steps to successfully grant permissions to the user.
Insert picture description here

solution:

mysql> create user 'reader'@'%' identified by '123456';
Query OK, 0 rows affected (0.01 sec)

mysql> grant all privileges on *.* to 'reader'@'%' with grant option;
Query OK, 0 rows affected (0.00 sec)

Guess you like

Origin blog.csdn.net/qq_41486775/article/details/114271134