Last active
December 28, 2015 05:09
-
-
Save taichiman/7447319 to your computer and use it in GitHub Desktop.
MySQL, mysql
This file contains 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
You can reset the root password by running the server with --skip-grant-tables and logging in without a password by running the following as root (or with sudo): | |
# service mysql stop | |
# mysqld_safe --skip-grant-tables & | |
$ mysql -u root | |
mysql> use mysql; | |
mysql> update user set password=PASSWORD("YOUR-NEW-ROOT-PASSWORD") where User='root'; | |
mysql> flush privileges; | |
mysql> quit | |
# service mysql stop | |
# service mysql start | |
$ mysql -u root -p | |
Now you should be able to login as root with your new password. | |
It is also possible to find the query that reset the password in /home/$USER/.mysql_history or /root/.mysql_history of the user who reset the password, but the above will always work. | |
=== | |
mysqldump --all-databases --all-routines -u root -p > ~/fulldump.sql | |
=== |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment