Operation ALTER USER failed for 'root'
ERROR 1396 (HY000): Operation ALTER USER failed for 'root'@'%'
or
ERROR 1396 (HY000): Operation ALTER USER failed for 'root'@'localhost'
The case:
root password was damaged and login with root user is failed.
Solution:
- Connect to MySQL with another user
- Update root set authentication_string=null
- FLUSH PRIVILEGES;
- Logout (quit)
- Connect to MySQL using "mysql -u root"
- Set root password
- Logout (quit)
C:\Program Files\MySQL\MySQL Server 8.0\bin> mysql -uusername -ppasswordmysql> UPDATE mysql.user SET authentication_string=null WHERE User='root';Query OK, 1 row affected (0.01 sec)Rows matched: 1 Changed: 1 Warnings: 0mysql> FLUSH PRIVILEGES;Query OK, 0 rows affected (0.31 sec)mysql> quitByeC:\Program Files\MySQL\MySQL Server 8.0\bin>mysql -u rootmysql> ALTER USER 'root'@'%' IDENTIFIED BY 'newrootpassword';Query OK, 0 rows affected (0.26 sec)mysql> quitBye
No comments:
Post a Comment