Advertisement
Guest User

Untitled

a guest
Jan 20th, 2016
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.57 KB | None | 0 0
  1. [MySQL] Reset root password
  2. ===========================
  3.  
  4. ### Stop MySQL service
  5.  
  6. ```
  7. $ [sudo] service mysqld stop
  8. ```
  9.  
  10. ### Start MySQL in safe mode
  11.  
  12. ```
  13. $ [sudo] mysqld_safe --skip-grant-tables &
  14. ```
  15.  
  16. ### Connect to MySQL server without password
  17.  
  18. ```
  19. $ [sudo] mysql -u root
  20. ```
  21. or
  22.  
  23. ```
  24. $ [sudo] mysql
  25. ```
  26.  
  27. ### Change the password
  28.  
  29. ```
  30. mysql> UPDATE mysql.user SET password = PASSWORD('newpassword') WHERE user = 'root';
  31. mysql> quit;
  32. ```
  33.  
  34. ### Restart MySQL server
  35.  
  36. ```
  37. $ [sudo] service mysqld start
  38. ```
  39.  
  40. ### Check if the new password works
  41.  
  42. ```
  43. $ [sudo] mysql -u root -p'newpassword'
  44. ```
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement