Guest User

Untitled

a guest
Jul 23rd, 2018
149
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.20 KB | None | 0 0
  1. # vi /etc/my.cnf
  2. 在[mysqld]的段中加上一句:skip-grant-tables
  3. 例如:
  4. [mysqld]
  5. datadir=/var/lib/mysql
  6. socket=/var/lib/mysql/mysql.sock
  7. skip-grant-tables
  8. 保存并且退出vi。
  9. 3.重新启动mysqld
  10. # /etc/init.d/mysqld restart
  11. Stopping MySQL: [ OK ]
  12. Starting MySQL: [ OK ]
  13. 4.登录并修改MySQL的root密码
  14. # /usr/bin/mysql
  15. Welcome to the MySQL monitor. Commands end with ; or \g.
  16. Your MySQL connection id is 3 to server version: 3.23.56
  17. Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
  18. mysql> USE mysql ;
  19. Reading table information for completion of table and column names
  20. You can turn off this feature to get a quicker startup with -A
  21. Database changed
  22. mysql> UPDATE user SET Password = password ( 'new-password' ) WHERE User = 'root' ;
  23. Query OK, 0 rows affected (0.00 sec)
  24. Rows matched: 2 Changed: 0 Warnings: 0
  25. mysql> flush privileges ;
  26. Query OK, 0 rows affected (0.01 sec)
  27. mysql> quit
  28. Bye
  29. 5.将MySQL的登录设置修改回来
  30. # vi /etc/my.cnf
  31. 将刚才在[mysqld]的段中加上的skip-grant-tables删除
  32. 保存并且退出vi。
  33. 6.重新启动mysqld
  34. # /etc/init.d/mysqld restart
  35. Stopping MySQL: [ OK ]
  36. Starting MySQL: [ OK ]
  37.  
  38. Work for fun,Live for love!
Add Comment
Please, Sign In to add comment