Advertisement
ferdinand

MySQL password recover [DB]

Jan 23rd, 2012
420
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.62 KB | None | 0 0
  1. How To Recover Your MySQL root Password
  2. in 6 easy steps:
  3.  
  4. Step 1: Stop the mysql service
  5. # /etc/init.d/mysql stop
  6. Expected Output:
  7. Stopping MySQL database server: mysqld.
  8. Step 2: Start the MySQL server without password
  9. # mysqld_safe --skip-grant-tables &
  10. Expected Output:
  11. [1] 5988
  12. Starting mysqld daemon with databases from /var/lib/mysql
  13. mysqld_safe[6025]: started
  14. Step 3: Connect to your MySQL server using the MySQL client
  15. # mysql -u root
  16. Expected Output:
  17. Welcome to the MySQL monitor. Commands end with ; or \g.
  18. Your MySQL connection id is 1 to server version: 4.1.15-Debian_1-log
  19.  
  20. Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
  21.  
  22. mysql>
  23. Step 4: Setup a new MySQL password for the root user
  24. mysql> use mysql;
  25. mysql> update user set password=PASSWORD("YOUR-NEW-PASSWORD") where User='root';
  26. mysql> flush privileges;
  27. mysql> quit;
  28. Expected Output:
  29. Database changed
  30.  
  31. Query OK, 0 rows affected (0.00 sec)
  32. Rows matched: 1 Changed: 0 Warnings: 0
  33.  
  34. Query OK, 0 rows affected (0.00 sec)
  35.  
  36. Bye
  37. Step 5: Stop the MySQL Server
  38. # /etc/init.d/mysql stop
  39. Expected Output:
  40. Stopping MySQL database server: mysqld
  41. STOPPING server from pid file /var/run/mysqld/mysqld.pid
  42. mysqld_safe[6186]: ended
  43.  
  44. [1]+ Done mysqld_safe --skip-grant-tables
  45. Step 6: Start the MySQL server and test it
  46. # /etc/init.d/mysql start
  47. # mysql -u root -p
  48. Expected Output:
  49. Starting service MySQL done
  50.  
  51. Welcome to the MySQL monitor. Commands end with ; or \g.
  52. Your MySQL connection id is xx
  53. Server version: x.x.xx XXXXX MySQL RPM
  54.  
  55. Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
  56.  
  57. mysql>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement