Mysql password expired. Can't connect
If your MySQL password has expired and you can't connect, you will need to reset the password.
If your MySQL password has expired and you can't connect, you will need to reset the password. Here are the steps to reset the password:
Note: These steps are for MySQL 5.7 and 8.0+. The PASSWORD() function and Password column are deprecated and removed in these versions.
- Stop the MySQL server:
sudo systemctl stop mysql - Start the MySQL server in safe mode with the skip-grant-tables option:
sudo mysqld --skip-grant-tables --skip-networking & - Connect to MySQL:
mysql -u root - Update the password for the root user:
ALTER USER 'root'@'localhost' IDENTIFIED BY 'new_password'; - Exit MySQL:
exit - Stop the MySQL server:
sudo systemctl stop mysql - Start the MySQL server normally:
sudo systemctl start mysql
You should now be able to connect to MySQL using the new password you set.