3

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.

Maantje
  • 1,781
  • 2
  • 20
  • 33
  • I do not know if that works. But try to make a new user with new password and admin-privilegs. Then change or delete the old one... – ratmalwer Nov 18 '17 at 00:02
  • @ratmalwer I can't ```mysql> CREATE USER 'new'@'localhost' IDENTIFIED BY 'new'; ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.``` – Maantje Nov 18 '17 at 00:05
  • Export your Tables - create a new DB - hopfully that works!! – ratmalwer Nov 18 '17 at 00:11
  • @ratmalwer The data isn't of any importance luckily. So I tried to reinstall it ```brew uninstall --force mysql``` followed by ```brew install mysql``` which did not work. creating a new database also does not work it :/ – Maantje Nov 18 '17 at 00:18

1 Answers1

1

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?

albert200000
  • 335
  • 3
  • 13