Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- How to Hack Mysql Root Password :
- Method 1 :
- 1.Stop MySQL daemon if it is currently running by killing all mysqld and mysqld_safe processes:
- #pkill mysql
- #pkill mysql-safe
- 2.Create a file /root/reset-mysql-password and fit it with following contents:
- UPDATE mysql.user SET Password=PASSWORD(’newpA$$w0rd’) WHERE User=’root’;
- FLUSH PRIVILEGES;
- 3.To reset the password, run MySQL daemon in safe mode and pass the SQL statements from above-created file:
- #mysqld_safe –init-file=/root/reset-mysql-password &
- •Password should be changed. Next, delete created file, stop MySQL and start it normally:
- #rm /root/reset-mysql-password
- #pkill mysql-safe
- #/etc/init.d/mysql start
- •The password could be checked with following command:
- #mysql -u root –p
- Method 2:
- 1.Again, stop MySQL daemon if it is currently running by killing all mysqld and mysqld_safe processes:
- #pkill mysql
- #pkill mysql-safe
- 2.To reset the password run MySQL daemon in safe mode with following options:
- #mysqld_safe –skip-grant-tables –skip-networking &
- 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.
- •Next, login to MySQL as root with no password and use the mysql database:
- # mysql -u root mysql
- •The password could be changed with UPDATE statement:mysql>
- UPDATE user SET Password=PASSWORD(’newpA$$’) WHERE User=’root’;
- mysql> FLUSH PRIVILEGES;
- If error occurs (possibly the root username was deleted), GRANT statement could be used to change the password:
- mysql> GRANT ALL PRIVILEGES ON *.* TO ‘root’@'localhost’ IDENTIFIED BY ‘newpA$$’;
- mysql> FLUSH PRIVILEGES;
- •After password is reset, MySQL safe daemon should be stopped and started normally:
- #pkill mysql-safe
- #/etc/init.d/mysql start
- •The password could be checked with following command:
- #mysql -u root -p
Add Comment
Please, Sign In to add comment