更改密码后无法登录mysql 5.7.9 [英] Can not login to mysql 5.7.9 after change password

查看:140
本文介绍了更改密码后无法登录mysql 5.7.9的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经使用EditLine包装器为Linux(x86_64)安装了Mysql 版本14.14 Distrib 5.7.9 ,在 CentOS Linux版本7.1.1503

I have installed Mysql Ver 14.14 Distrib 5.7.9, for Linux (x86_64) using EditLine wrapper On CentOS Linux release 7.1.1503

我使用以下命令更改了root密码:

I Changed root password using this command:

alter user 'root'@'localhost' identified by 'XXXXXXX';  
flush privileges;

重新登录后

[root@server ~]# mysql -u root -p
Enter password: 

错误1524(HY000):插件 '* A6074285732753D325C55AD74E7517CF442C1A81'未加载

ERROR 1524 (HY000): Plugin '*A6074285732753D325C55AD74E7517CF442C1A81' is not loaded

推荐答案

自从早期版本的mySQL(我使用5.7.10)以来,发生了两件事:

Two things have changed since earlier versions of mySQL (I''m using 5.7.10):

  1. systemd现在用于管理mySQL而不是mysqld_safe(这就是为什么我得到-bash: mysqld_safe: command not found错误-未安装的原因)

  1. systemd is now used to look after mySQL instead of mysqld_safe (which is why I was getting the -bash: mysqld_safe: command not found error - it's not installed)

user表结构已更改.

因此,要重置根密码,您仍然可以使用--skip-grant-tables选项启动mySQL并更新user表,但是操作方式已更改.

So to reset the root password, you still start mySQL with --skip-grant-tables options and update the user table, but how you do it has changed.

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

注意

从MySQL 5.7.6开始,用于使用RPM安装MySQL 分发,服务器启动和关闭由systemd在 几个Linux平台.在这些平台上,mysqld_safe不再是 安装,因为它是不必要的.有关更多信息,请参见部分. 2.5.10,使用systemd管理MySQL服务器".

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=.

Which takes you to http://dev.mysql.com/doc/refman/5.7/en/server-management-using-systemd.html where it mentions the systemctl set-environment MYSQLD_OPTS= towards the bottom of the page.

密码重置命令位于 http://dev.mysql的底部. com/doc/refman/5.7/en/reset-permissions.html

这篇关于更改密码后无法登录mysql 5.7.9的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆