例:create user 'user02'@'localhost' identified by 'yx';
如果报错:
mysql> create user '3110006389'@'localhost' identified by '6389';
Query OK, 0 rows affected (0.00 sec)mysql> grant all on *.* to '3110006389'@'localhost';
ERROR 1133 (42000): Can't find any matching row in the user table
问题出现在,因为我们在create user时修改了mysql.user表之后,
没有使用FLUSH PRIVILEGES命令来更新权限表(grant tables).
所以在执行grant on时执行flush privileges就没有这个错误了。(2) insert into user(host,user,password) values("localhost","user02",password("yx"));
如果报错:
原因:在我的配置文件my.ini中有这样一条语句
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
解决办法:打开my.ini,查找
sql-mode="STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION"
sql-mode="NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION"