第一种方法:
原因:在我的配置文件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
转载于:https://blog.51cto.com/sonice/1875597