Guest User

Untitled

a guest
Apr 17th, 2018
122
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.88 KB | None | 0 0
  1. How to Hack Mysql Root Password :
  2.  
  3. Method 1 :
  4. 1.Stop MySQL daemon if it is currently running by killing all mysqld and mysqld_safe processes:
  5. #pkill mysql
  6. #pkill mysql-safe
  7. 2.Create a file /root/reset-mysql-password and fit it with following contents:
  8. UPDATE mysql.user SET Password=PASSWORD(’newpA$$w0rd’) WHERE User=’root’;
  9. FLUSH PRIVILEGES;
  10. 3.To reset the password, run MySQL daemon in safe mode and pass the SQL statements from above-created file:
  11. #mysqld_safe –init-file=/root/reset-mysql-password &
  12.  
  13.  
  14. •Password should be changed. Next, delete created file, stop MySQL and start it normally:
  15. #rm /root/reset-mysql-password
  16. #pkill mysql-safe
  17. #/etc/init.d/mysql start
  18. •The password could be checked with following command:
  19. #mysql -u root –p
  20. Method 2:
  21. 1.Again, stop MySQL daemon if it is currently running by killing all mysqld and mysqld_safe processes:
  22. #pkill mysql
  23. #pkill mysql-safe
  24. 2.To reset the password run MySQL daemon in safe mode with following options:
  25. #mysqld_safe –skip-grant-tables –skip-networking &
  26. In –skip-grant-tables mode, anyone can log into the server and do as they please. When starting with this flag, it is preferable to use –skip-networking flag for security reasons.
  27.  
  28.  
  29.  
  30. •Next, login to MySQL as root with no password and use the mysql database:
  31. # mysql -u root mysql
  32. •The password could be changed with UPDATE statement:mysql>
  33. UPDATE user SET Password=PASSWORD(’newpA$$’) WHERE User=’root’;
  34. mysql> FLUSH PRIVILEGES;
  35. If error occurs (possibly the root username was deleted), GRANT statement could be used to change the password:
  36.  
  37. mysql> GRANT ALL PRIVILEGES ON *.* TO ‘root’@'localhost’ IDENTIFIED BY ‘newpA$$’;
  38. mysql> FLUSH PRIVILEGES;
  39. •After password is reset, MySQL safe daemon should be stopped and started normally:
  40. #pkill mysql-safe
  41. #/etc/init.d/mysql start
  42. •The password could be checked with following command:
  43. #mysql -u root -p
Add Comment
Please, Sign In to add comment