我已经安装了 Mysql Ver 14.14 Distrib 5.7.9, for Linux (x86_64) using EditLine wrapper 在 CentOS Linux release 7.1.1503
我使用此命令更改了 root 密码:
alter user 'root'@'localhost' identified by 'XXXXXXX';
flush privileges;
重新登录后
[root@server ~]# mysql -u root -p
Enter password:
ERROR 1524 (HY000): Plugin '*A6074285732753D325C55AD74E7517CF442C1A81' is not loaded
最佳答案
自早期版本的 mySQL 以来有两件事发生了变化(我使用的是 5.7.10):
systemd
现在用于管理 mySQL 而不是mysqld_safe
(这就是为什么我得到-bash: mysqld_safe: command not found
错误 - 未安装)user
表结构已更改。
所以要重置 root 密码,您仍然可以使用 --skip-grant-tables
选项启动 mySQL 并更新 user
表,但是您的操作方式已经改变.
1. Stop mysql:
systemctl stop mysqld
2. Set the mySQL environment option
systemctl set-environment MYSQLD_OPTS="--skip-grant-tables"
3. Start mysql usig the options you just set
systemctl start mysqld
4. Login as root
mysql -u root
5. Update the root user password with these mysql commands
mysql> UPDATE mysql.user SET authentication_string = PASSWORD('MyNewPassword')
-> WHERE User = 'root' AND Host = 'localhost';
mysql> FLUSH PRIVILEGES;
mysql> quit
6. Stop mysql
systemctl stop mysqld
7. Unset the mySQL envitroment option so it starts normally next time
systemctl unset-environment MYSQLD_OPTS
8. Start mysql normally:
systemctl start mysqld
Try to login using your new password:
7. mysql -u root -p
引用
正如它在 http://dev.mysql.com/doc/refman/5.7/en/mysqld-safe.html 中所说的那样,
Note
As of MySQL 5.7.6, for MySQL installation using an RPM distribution, server startup and shutdown is managed by systemd on several Linux platforms. On these platforms, mysqld_safe is no longer installed because it is unnecessary. For more information, see Section 2.5.10, “Managing MySQL Server with systemd”.
将您带到 http://dev.mysql.com/doc/refman/5.7/en/server-management-using-systemd.html它在页面底部提到 systemctl set-environment MYSQLD_OPTS=
。
密码重置命令位于 http://dev.mysql.com/doc/refman/5.7/en/resetting-permissions.html 的底部
关于mysql - 修改密码后无法登录mysql 5.7.9,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33374314/