新建用户
一、直接创建用户
二、赋权也可以创建用户
方法一:
进入mysql:
create user username@主机 identified by 密码;
验证:select user,host,password from user;
方法二:
grant 权限列表 on 库.表 to 用户@主机 identified by 密码;
grant all on . to test1@localhost identified by’123’;
刷新权限:flush privileges;
为什么要刷新:
https://blog.youkuaiyun.com/SkyingData/article/details/104417022
查看权限:
show grants for 用户@主机;
部分授权:
grant 权限 on 库.表 to 用户@主机 identified by密码;
grant select on mysql.db to test@localhost identified by’123’;
取消授权:
revoke 权限列表 on 库.表 from 用户@主机;
revoke select from mysql.db from test@localhost;
删除用户:
drop user 用户@主机;
drop user test@localhost;