MySQL5.7添加新用户 出现ERROR 1364 (HY000): Field 'ssl_cipher' doesn't have a default value
解决方法1:
insert into user (host,user,authentication_string,select_priv,insert_priv,update_priv) values ('%' , 'mma' ,PASSWORD('123456'),'Y','Y','Y');
原因:
在我的配置文件my.cnf中有这样一条语句sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
指定了严格模式,为了安全,严格模式禁止通过insert 这种形式直接修改MySQL库中的user表进行添加新用户
解决方法:
将配置文件中的STRICT_TRANS_TABLES删掉,即改为:
sql_mode=NO_ENGINE_SUBSTITUTION
然后重启mysql即可
解决方法2(推荐):##
添加用户:
grant usage on *.* to 'mma'@'%' identified by '123456' with grant option;
赋予权限
grant all privileges on *.* to 'mma'@'%' identified by '123456';
or
grant select,insert,update,delete,create,drop ON TUTORIALS.* TO 'mma'@'%' IDENTIFIED BY '123456';
刷新权限
flush privileges;