Skip to content

Instantly share code, notes, and snippets.

@quietcricket
Created January 19, 2012 09:54
Show Gist options
  • Save quietcricket/1639122 to your computer and use it in GitHub Desktop.
Save quietcricket/1639122 to your computer and use it in GitHub Desktop.
Reset MySQL password
#stop server
service mysqld stop
#start server without checking password
mysqld_safe --skip-grant-tables &
#log into server as root and specify "mysql" is the database going to be used
mysql --user=root mysql
#update the password
update user set Password=PASSWORD('new-password-here') WHERE User='root';
#make the changes to take effect
flush privileges;
#stop the server in safe mode
service mysqld stop
#start the server back again
service mysqld start
#log in as root
mysql -u root -p
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment