Tag Archives: ERROR 1396 (HY000)

[Solved] ERROR 1396 (HY000): Operation ALTER USER failed for ‘root‘@‘localhost‘

MySQL Connect database error:
1251 client does not support authentication protocol requested by server; consider upgrading Mysql client ERROR 1396 (HY000): Operation ALTER USER failed for ‘root’@’localhost’

Pre-registered mysql

mysql -u root -p

Input password

mysql> use mysql;
mysql> select user,host from user;

Note that my root and host are ‘%’
you may execute:

ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'root';

Change to:

ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY 'root';

Operation record:

mysql> ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'root';
ERROR 1396 (HY000): Operation ALTER USER failed for 'root'@'localhost'
mysql> use mysql;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
mysql> select user,host from user;
+------------------+-----------+
| user             | host      |
+------------------+-----------+
| root             | %         |
| mysql.infoschema | localhost |
| mysql.session    | localhost |
| mysql.sys        | localhost |
+------------------+-----------+
4 rows in set (0.00 sec)

mysql> ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY 'root';
Query OK, 0 rows affected (0.00 sec)

mysql> quit
Bye

[MySQL] error 1396 (HY000): Operation create user failed for ‘MySQL’ @’localhost ‘

Error 1396 (HY000): Operation create user failed for ‘MySQL’ @’localhost ‘

reason:

Delete MySQL users directly use delete from mysql.user where user like ‘%mysql%’;

Then create MySQL again and report the user’s error;

solve:

Check to see if there is this user

mysql> select distinct user from mysql.user;
+-------+
| user  |
+-------+
| root  |
+-------+
1 rows in set (0.00 sec)

Using drop to delete users

mysql> drop user 'mysql'@'localhost';

After deleting, you can re create the user. If you report the same error, you may encounter a MySQL bug and need to refresh the permissions

mysql> flush privileges;

Then recreate the user

mysql> create user 'mysql'@'localhost' identified by 'mysql';