更改用户插件后,MySQL root访问权限丢失

时间:2018-06-08 10:04:24

标签: mysql root

我遇到连接MySQL实例的问题,并决定将root插件从caching_sha2_password更改为mysql_native_password

mysql> select host,user, account_locked, plugin  from mysql.user;
+-----------+------------------+----------------+-----------------------+
| host      | user             | account_locked | plugin                |
+-----------+------------------+----------------+-----------------------+
| %         | root             | N              | caching_sha2_password |
| localhost | mysql.infoschema | Y              | mysql_native_password |
| localhost | mysql.session    | Y              | mysql_native_password |
| localhost | mysql.sys        | Y              | mysql_native_password |
| localhost | root             | N              | caching_sha2_password |
+-----------+------------------+----------------+-----------------------+
5 rows in set (0.00 sec)

mysql> update mysql.user set plugin = 'mysql_native_password' where user = 'root'
    -> ;
Query OK, 2 rows affected (0.04 sec)
Rows matched: 2  Changed: 2  Warnings: 0

mysql> select host,user, account_locked, plugin  from mysql.user;
+-----------+------------------+----------------+-----------------------+
| host      | user             | account_locked | plugin                |
+-----------+------------------+----------------+-----------------------+
| %         | root             | N              | mysql_native_password |
| localhost | mysql.infoschema | Y              | mysql_native_password |
| localhost | mysql.session    | Y              | mysql_native_password |
| localhost | mysql.sys        | Y              | mysql_native_password |
| localhost | root             | N              | mysql_native_password |
+-----------+------------------+----------------+-----------------------+

我重新启动了实例,现在我无法登录!

bitnami@bit2:~$ mysql -u root -p
Enter password:
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)

是否有将root密码插件更改回caching_sha2_password

使用mysql_native_password

是否存在root的默认密码

0 个答案:

没有答案