先停止服务

C:\Program Files\MySQL\MySQL Server 5.5\bin>sc stop MySql

SERVICE_NAME: MySql
        TYPE               : 10  WIN32_OWN_PROCESS
        STATE              : 3  STOP_PENDING
                                (STOPPABLE, PAUSABLE, ACCEPTS_SHUTDOWN)
        WIN32_EXIT_CODE    : 0  (0x0)
        SERVICE_EXIT_CODE  : 0  (0x0)
        CHECKPOINT         : 0x1
        WAIT_HINT          : 0x5265c00

C:\Program Files\MySQL\MySQL Server 5.5\bin>mysqld --skip-grant-tables

另外开一个窗口 空密码登陆

C:\Program Files\MySQL\MySQL Server 5.5\bin>mysql -u root


mysql> select user,password from mysql.user;
+------+-------------------------------------------+
| user | password                                  |
+------+-------------------------------------------+
| root | *5741528DB1765E0ADE5F5BCA0EF1298FC84B61FB |
+------+-------------------------------------------+

cmd5 收费 k8team


565491d704013245 mysql hash 密码 123456

//密码模式1
mysql>  SET old_passwords = 0;  
mysql> select password('123456')from dual;
+-------------------------------------------+
| password('123456')                        |
+-------------------------------------------+
| *6BB4837EB74329105EE4568DDA7DC67ED2CA2AD9 |
+-------------------------------------------+
1 row in set (0.00 sec)

//密码模式2
mysql>  SET old_passwords = 1;
Query OK, 0 rows affected (0.01 sec)

mysql> select password('123456')from dual;
+--------------------+
| password('123456') |
+--------------------+
| 565491d704013245   |
+--------------------+
1 row in set (0.00 sec)