#停止mysql # --skip-grant-tables 启动,跳过认证 ./mysqld_safe --skip-grant-tables #直接mysql进入,置空密码 mysql> update user set authentication_string='' where user='zhangsan3'; Query OK, 1 row affected (0.31 sec) #停止mysql ./mysqladmin shutdown #常规方式启动 /etc/init.d/mysql start #重新登录,密码为空,直接回车进入,并重新修改密码 mysql -uzhangsan3 -hlocalhost -p mysql> ALTER USER 'zhangsan3'@'%' IDENTIFIED BY '123456'; Query OK, 0 rows affected (0.11 sec) flush privileges;