It’s funny what I consider activities for closing out the end of a year and the start of a new one. One of the many things I do is ensure that all my personal and managed domain names are renewed for the coming year. Another fun time is to dig into my pile of old equipment to see what can be recycled or used. On one of the machines I was poking around with, I discovered that the root password for MySQL had expired while I was trying to take a look at the DBs that were still hanging around.
The expiration message was similar to this:
Error 1820. Your password has expired. To log in you must change it using a client that supports expired passwords.
Well, great. Now I have to Google something just to see if I care about (or don’t already have backups of) these databases =D I discovered from some reading that password expiration is a ‘new’ feature of MySQL 5.6+.
The Windows MySQL documentation wasn’t a huge help, but Stackoverflow was. Posting here: http://stackoverflow.com/questions/33387879/mysql-password-expired-cant-connect
- On your Windows machine, open a command prompt.
- at the prompt you’ll type: mysql -u root -p
- then use your “enter” key 🙂
- at the following prompt, enter your old password for the “root” account. Hopefully you know it because that can be an entirely different problem!
- At the next mysql> prompt you’re going to enter all of the below with the contents of ‘new_password’ changed to whatever you want the new password to be, then hit “enter”.ALTER USER ‘root’@’localhost’ IDENTIFIED BY ‘new_password‘, ‘root’@’localhost’ PASSWORD EXPIRE NEVER;
This took care of the problem with the added benefit of not having to worry about changing the password again in the future because of the “EXPIRE NEVER” portion. I also didn’t have to install any additional software to make this update.
In my case I set the password back to what it was previously for the sake of convenience. With my hard-won access to the DBs I discovered that I already had backups of all of them elsewhere. Better safe than sorry, though!