Mysql password expired. Can't connect

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:

  1. Stop the MySQL server: sudo service mysql stop
  2. Start the MySQL server in safe mode with the skip-grant-tables option: sudo mysqld_safe --skip-grant-tables &
  3. Connect to MySQL: mysql -u root
  4. Update the password for the root user: UPDATE mysql.user SET Password=PASSWORD('new_password') WHERE User='root';
  5. Reload the privilege tables: FLUSH PRIVILEGES;
  6. Exit MySQL: exit
  7. Stop the MySQL server: sudo service mysql stop
  8. Start the MySQL server normally: sudo service mysql start

You should now be able to connect to MySQL using the new password you set.