1. root 登录
use mysql;
show tables;
select host,user from user;
- 创建用户密码
create user ly identified by ‘123456’;
create user ly identified by '123456';
- 分配权限
grant all privileges on . to ‘ly’@’%'identified by ‘123456’ with grant option;
grant all privileges on *.* to 'ly'@'%'identified by '123456' with grant option;
all 代表接受所有操作,比如 增删改查
5. 刷新 后查看
flush privileges ;
flush privileges ;
select host,user from user;
验证: