mysql> SHOW GRANTS \g
***************************1. Row ***************************
Grants for[Email protected]: GRANT all privileges on * * to'Root'@'localhost'Ide
Ntified by PASSWORD'*11b9aca21786f766739d0eb1483c5f64212b81ac'With GRANT Optio
N
***************************2. Row ***************************
Grants for[Email protected]: GRANT PROXY on"'@"'To'Root'@'localhost'With GRANT
OPTION
2RowsinchSet(0.00Sec
If the current account has all permissions, the simplest new user can be used and authorized:
Grant all on * * to ' root ' @ '% ' identified by ' 123456 ' with Grant option;mysql> grant all on * * to'Gechong'@'localhost'Identified by'Ge0513.mysql'WI
TH GRANT OPTION;
Query OK,0Rows Affected (0.03Sec
Mysql> SELECT user,host from Mysql.user;
+---------+-----------+| USER | HOST |+---------+-----------+| Root | 127.0.0.1 | | Gechong | localhost | | Root | localhost |+---------+-----------+3 rows in Set (0.00 sec)
where with GRANT option indicates whether the new account has the grant permission, that is, whether or not it can be created by it.
It is very not recommended to open all permissions to the user, it is best to give new users only the relevant permissions required to open. General Select,update,delete,insert,create,execute for Developerspermissions and access only within certain network segments
For example:
MySQL > GRANT insert,update,delete,select,create,execute on * * to ' KAIFAA ' @ ' 10.1
2.%.% ' identified by ' kaifaa.mysql ';
Query OK, 0 rows Affected (0.00 sec)
User Gechong has only 6 permissions and can only be used within the 10.1.*.* network segment.
MySQL Rights Management