MySQL添加新用户 出现mysql]ERROR 1364 (HY000): Field 'ssl_cipher' doesn't have a default value

时间:2022-09-19 20:34:48

第一种方法:

原因:在我的配置文件my.cnf中有这样一条语句

sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES

指定了严格模式,为了安全,严格模式禁止通过insert 这种形式直接修改MySQL库中的user表进行添加新用户

 

解决办法:

将配置文件中的STRICT_TRANS_TABLES删掉,即改为:

sql_mode=NO_ENGINE_SUBSTITUTION

然后重启mysql即可

 

第二种方法(推荐):

grant usage on *.* to 'username'@'hostname' identified by 'passwd' with grant option;  //添加用户

grant all privileges on *.* to 'username'@'hostname' identified by 'passwd';  //添加权限

flush privileges; //更新权限

来自:http://blog.csdn.net/xiexingshishu/article/details/46885497