文檔摘抄mysql
root@mysql-5.1.51> SET SESSION old_passwords=0; Query OK, 0 rows affected (0.00 sec)web
root@mysql-5.1.51> SELECT PASSWORD('123456'); +-------------------------------------------+ | PASSWORD('123456') | +-------------------------------------------+ | *6BB4837EB74329105EE4568DDA7DC67ED2CA2AD9 | +-------------------------------------------+ 1 row in set (0.00 sec)sql
root@mysql-5.1.51> SET SESSION old_passwords=1; Query OK, 0 rows affected (0.00 sec)ip
root@mysql-5.1.51> SELECT PASSWORD('123456'); +--------------------+ | PASSWORD('123456') | +--------------------+ | 565491d704013245 | +--------------------+ 1 row in set (0.00 sec文檔
實際操做: 登錄mysql,使用SET SESSION old_passwords=0; //設置老格式密碼 SET PASSWORD FOR 'webuser'@'localhost' = PASSWORD('123456') //而後爲用戶設置密碼。get
修改配置文件: [client] secure_auth = 0 [mysqld] old_passwords=1table
成功登錄!cli
忘記用戶密碼時: [mysqld] skip-grant-tables配置
而後不用口令進入mysql修改密碼:密碼
UPDATE mysql.user SET Password=PASSWORD("newpassword") WHERE User='root' and Host='localhost';