1.创建用户
1)登录MySQL
mysql> mysql -u root -p;
-> root
mysql> GRANT USAGE ON . TO ‘user01’@‘localhost’ IDENTIFIED BY ‘123456’ WITH GRANT OPTION;
2)查询用户信息
mysql>select user,authentication_string,password_expired,password_last_changed,password_lifetime,ssl_cipher from mysql.user;
3)刷新权限
mysql> flush privileges;
4)修改密码(选做)
mysql> update user set authentication_string=‘123’ where user=‘user01;
2.配置权限
1)CRUD均有权限
mysql> grant select,delete,update,create,drop on specie.* to user01@localhost identified by ‘123’;
2)只拥有查询权限
mysql> grant select on specie.* to user01@localhost identified by ‘123’;
3)刷新权限
mysql> flush privileges;
个人笔记,仅供参考!