MySQL新增用户
文章目录
添加用户
1 | mysql> use mysql; |
- 得到报错信息:
ERROR 1364 (HY000): Field 'ssl_cipher' doesn't have a default value
- 该报错是因为MySQL默认配置了严格模式,该模式禁止通过
insert
的方式直接修改mysql库中的user表进行添加新用户,需要使用grant
语句。
- 新增用户,’guest’为用户名 ,’localhost’为host,’password123’为密码
1
mysql> create user 'guest'@'localhost' identified by 'password123';
- 赋予权限 select, insert, update, delete, create, drop
1
2mysql> grant usage on *.* to 'guest'@'localhost' with grant option;
mysql> grant select, insert, update, delete, create, drop on *.* to 'guest'@'localhost' with grant option; - 重新载入授权表
1
mysql> flush privileges