2 回答
千巷猫影
TA贡献1829条经验 获得超7个赞
一、检查是否已经有root用户
mysql> use mysql; mysql> select user from user; 查看是否有root用户
二、你这个报错多半是已经有该用户
mysql> create user 'test2'@'localhost' identified by '123'; Query OK, 0 rows affected (0.01 sec) mysql> create user 'test2'@'localhost' identified by '123'; ERROR 1396 (HY000): Operation CREATE USER failed for 'test2'@'localhost'
三、如果有,删除用户,重新创建即可,或者修改密码
删除后再创建 mysql>delete user from user where User='test2'; 或者修改root密码 mysql>UPDATE user SET Password = password('new-password') WHERE User = 'root';
添加回答
举报
0/150
提交
取消