Mysql卡在过期的密码循环中

时间:2017-11-17 23:55:38

标签: mysql-5.7

我无法再使用mysql 5.70.20 macOS 10.13.1连接到我的数据库,因为我收到以下消息。

Your password has expired. To log in you must change it using a client that supports expired passwords.

现在,这看起来很简单This answer。但不幸的是,我认为我陷入了困境。

这是我正在尝试的。 mysql -u root这可以按预期工作。连接后我尝试ALTER USER 'script'@'localhost' PASSWORD EXPIRE NEVER;给我一个ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.

之前我尝试了SET GLOBAL default_password_lifetime = 0;打印Query OK, 0 rows affected (0.00 sec)这个als没有解决问题,因为没有任何影响。

然后我尝试了SET PASSWORD = PASSWORD('root');打印ERROR 3009 (HY000): Column count of mysql.user is wrong. Expected 45, found 46. Created with MySQL 50718, now running 50720. Please use mysql_upgrade to fix this error.

所以我尝试运行推荐给我mysql_upgrade的内容,这让我回到原来的mysql_upgrade: Got error: 1862: Your password has expired. To log in you must change it using a client that supports expired passwords. while connecting to the MySQL server Upgrade process encountered error and will not continue.

1 个答案:

答案 0 :(得分:1)

在Ubuntu上为我工作的解决方案是完全删除mysql:

sudo rm -rf /var/lib/mysql/mysql
sudo apt-get remove --purge mysql-server mysql-client mysql-common
sudo apt-get autoremove
sudo apt-get autoclean
sudo apt-get install mysql-server

这也会删除系统表,因此您可以从头开始。
有人可以将其翻译为macOS吗?