恢复mysql的root口令:

向mysql server 发进kill 命令关掉 mysqld server 不要kill -9
kill ‘cat /mysql-data-directory/hostname.pid'

ps awux | grep mysql

杀掉进程。

使用 ’ --skip-grant-tables‘ 参数来启动mysqld
/usr/bin/mysqld_safe --skip-grant-tables &

使用 mysql -hhostname mysql命令登陆到mysqld server 上  用grant 命令改变口令
grant ALL on *.* to root@登陆主机 identified  by ”密码“
例如:grant ALL on *.* to lpdb@'%' identified by "";
mysqladmin -hhostname -uuser password 'newpassword'

use mysql;
update user set password = Password ('your pass') where user='root'

载入权限列表
mysqladmin -hhostname flush-privileges
FLUSH PRIVILEGES
也可重启mysql