[mysql]ERROR 1364 (HY000): Field 'ssl_cipher' doesn't have a default value 解决方法

在MySQL数据库中的mysql.user表中使用insert语句添加新用户时,可能会出现以下错误:

ERROR 1364 (HY000): Field 'ssl_cipher' doesn't have a default value

原因是在my.ini配置文件中有这样一条语句

sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES

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

方法一、修改my.ini配置文件

打开my.ini,查找 
sql-mode="STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION"
修改为
sql-mode="NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION"
然后重启MYSQL

方法二、grant授权方法

GRANT USAGE ON *.* TO 'username'@'localhost' IDENTIFIED BY 'password' WITH GRANT OPTION;

  然后对该用户进行书库和表授权

grant all privileges on *.* to 'username'@'localhost' identified by 'password';

//生效授权
flush privileges;

  


原文地址:https://www.cnblogs.com/rnckty/p/4595198.html