MySQL用户权限操作
查看当前用户:
select user,host from user;
或:
SELECT DISTINCT CONCAT(‘User: ‘‘‘,user,‘‘‘@‘‘‘,host,‘‘‘;‘) AS query FROM mysql.user;
创建用户:(创建一个用户可以从任何主机以密码123456远程访问MySQL)
create user ‘root‘@‘%‘ identified by ‘123456‘;
修改用户(修改指定用户可以从指定主机远程访问MySQL):
update user set host=‘%‘ where user=‘root‘;
删除用户:
delete from user where user=‘xxx‘ and host=‘xxx‘; // root localhost
用户受权:
grant all privileges on *.* to ‘root‘@‘%‘ identified by ‘123456‘;
刷新权限: (该步不能忘记)
FLUSH PRIVILEGES;
create user ‘root‘@‘%‘ identified by ‘123456‘;
相关推荐
CoderToy 2020-11-16
emmm00 2020-11-17
王艺强 2020-11-17
ribavnu 2020-11-16
bianruifeng 2020-11-16
wangshuangbao 2020-11-13
苏康申 2020-11-13
vivenwan 2020-11-13
moyekongling 2020-11-13
云中舞步 2020-11-12
要啥自行车一把梭 2020-11-12
aydh 2020-11-12
kuwoyinlehe 2020-11-12
minerk 2020-11-12
vitasfly 2020-11-12
jazywoo在路上 2020-11-11
敏敏张 2020-11-11
世樹 2020-11-11