数据库权限设置

MySQL数据库权限设置

创建用户及密码

1
CREATE USER handsomehan IDENTIFIED BY 'qwertyuiop';

设置权限

1
2
grant select, update, insert, delete on *.* to handsomehan@"%" indentified by 'qwertyuiop';
// 所有权限 -> all privileges

刷新数据库

1
flush privileges;

查看用户信息

1
select host, user from mysql.user;

查看用户权限

修改用户权限只能是root用户才可以。
1
show grants for handsomehan;

撤销权限

1
revoke all privileges on *.* to handsomehan@"%" indentified by 'qwertyuiop';

用户设置密码

1
set password for 'root'@'localhost' = password('414');