用户管理
1.用户的定义
用户名@‘白名单’
例如
mytest@‘localhost’ :mytest用户能够通过本地登录MYSQL(socket方式)
mytest@‘10.0.0.10’:mytest用户能够通过10.0.0.10(远程登录)
mytest@‘10.0.0.%’:mytest用户能够通过10.0.0.x/24远程登录
2.用户管理
查:
mysql> select user,host,authentication_string from mysql.user;
±--------------±----------±------------------------------------------+
| user | host | authentication_string |
±--------------±----------±------------------------------------------+
| root | localhost | *E74858DB86EBA20BC33D0AECAE8A8108C56B17FA |
| mysql.session | localhost | *THISISNOTAVALIDPASSWORDTHATCANBEUSEDHERE |
| mysql.sys | localhost | *THISISNOTAVALIDPASSWORDTHATCANBEUSEDHERE |
| my1 | localhost | *4ED17DD65450313CC5CFCD74DE1584D0138CA769 |
| my1 | 10.0.0.24 | *A2439236EAC06C361CCC450CCFAB0447D134DFE4 |
±--------------±----------±------------------------------------------+
5 rows in set (0.00 sec)
增:
mysql> create user mytest@‘localhost’;
mysql> create user mytest1@‘10.0.0.%’ identified by ‘mytest1’;
改:
alter user mytest@‘localhost’ identified by ‘mytest’;
删:
drop user mytest@‘localhost’;
注意:8.0版本之前,是可以通过grant命令建立用户+授权;但是8.0后,只能先建立用户,再授权;




