MySQL数据库的密码问题


今儿在做实验用到mysql数据库时,用户密码忘记了,让我也是找了半天:现在给大家介绍下我自己的方法:用到了mysql自身的函数来测试的。

  1. mysql> select user,password,host from user;  
  2. +------+------------------+-----------+  
  3. | user | password         | host      |  
  4. +------+------------------+-----------+  
  5. | root | 773359240eb9a1d9 | localhost |  
  6. | root |                  | fsailing1 |  
  7. | root |                  | 127.0.0.1 |  
  8. | root | 309e1248634a4f61 | %         |  
  9. +------+------------------+-----------+  
  10. 4 rows in set (0.00 sec)  
  11.   
  12. mysql> password("root");  
  13. ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'password("root")' at line 1  
  14. mysql> select password("root");  
  15. +------------------+  
  16. | password("root") |  
  17. +------------------+  
  18. | 67457e226a1a15bd |  
  19. +------------------+  
  20. 1 row in set (0.00 sec)  
  21.   
  22. mysql> select password("chen");  
  23. +------------------+  
  24. | password("chen") |  
  25. +------------------+  
  26. | 309e1248634a4f61 |  
  27. +------------------+  
  28. 1 row in set (0.00 sec)  

相关内容