Created
October 14, 2011 17:08
-
-
Save petasittek/1287696 to your computer and use it in GitHub Desktop.
MySQL - root password reset
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo /etc/init.d/mysql stop | |
# we have to --skip-networking to prevent connections out of localhost because mysql will now run absolutely unprotected | |
sudo /usr/sbin/mysqld --skip-grant-tables --skip-networking & | |
mysql -u root | |
# reload privileges from grant tables (free cached memory) | |
FLUSH PRIVILEGES; | |
USE mysql; | |
# set your new password | |
UPDATE user SET Password = PASSWORD('new password') WHERE Host = 'localhost' AND User = 'root'; | |
# reload the privileges again | |
FLUSH PRIVILEGES; | |
# restart | |
sudo /etc/init.d/mysql stop | |
sudo /etc/init.d/mysql start |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment