Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- [MySQL] Reset root password
- ===========================
- ### Stop MySQL service
- ```
- $ [sudo] service mysqld stop
- ```
- ### Start MySQL in safe mode
- ```
- $ [sudo] mysqld_safe --skip-grant-tables &
- ```
- ### Connect to MySQL server without password
- ```
- $ [sudo] mysql -u root
- ```
- or
- ```
- $ [sudo] mysql
- ```
- ### Change the password
- ```
- mysql> UPDATE mysql.user SET password = PASSWORD('newpassword') WHERE user = 'root';
- mysql> quit;
- ```
- ### Restart MySQL server
- ```
- $ [sudo] service mysqld start
- ```
- ### Check if the new password works
- ```
- $ [sudo] mysql -u root -p'newpassword'
- ```
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement