Mysql stuck in an expired password loop

Viewed 1775

I can no longer connect to my databases with mysql 5.70.20 on macOS 10.13.1 as I get the following message.

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

Now, this would seem like an easy fix. But unfortunately I think im stuck in a loop.

Here is what I am trying. mysql -u root this works as expected. After connecting im trying ALTER USER 'script'@'localhost' PASSWORD EXPIRE NEVER; which gives me an ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.

After the previous I tried SET GLOBAL default_password_lifetime = 0; which printed Query OK, 0 rows affected (0.00 sec) this als did not fix the problem as nothing was affected.

Then I tried SET PASSWORD = PASSWORD('root'); which printed 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..

So I try to run what it is recommending me mysql_upgrade and this puts me back to where I was 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 Answers

Solution worked for me on Ubuntu is complete removal of 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

This will also remove system tables so you can start from scratch.
Can someone translate this to macOS?

Related