创建用户报错Field 'ssl_cipher' doesn't have a default value
因为当时使用了这条语句直接插入用户表 insert into user (Host,user,authentication) values('%','zc','123');
提示ssl_cipher没有默认值,可是又不知道ssl_cipher是个什么字段,怎么办呢???
解决方法:
1.版本更新后改变了插入用户表的语句, 应该用这个
create user 'zc'@'%' identified by '123'; //用户名为zc ,'%'表示所有ip都可访问,'123'为密码
2.再赋予权限
grant usage on *.* to 'zc'@'%' with grant option;
grant select,insert,update,delete,create,drop on *.* to 'zc'@'%' with grant option; //给了zc账号 所有数据库中所有表的增删查改和建表删表的权限
flush privileges; //释放
这是创建用户后没赋予权限出现的报错:
mysql> select * from user \G;
ERROR 1142 (42000): SELECT command denied to user 'zc'@'localhost' for table 'user'
ERROR:
赋予权限之后就可以select了,赋权语句后面需要加上 with grant option
标签:ssl,grant,default,zc,Field,cipher,报错,user
From: https://www.cnblogs.com/superip/p/17242954.html