公司mysql dba把root密码丢失需要,方法如下,适合linux、unix机器

service d stop
 
/opt/mysql/bin/mysqld_safe --skip-grant-tables &
 
/opt/mysql/bin/mysql -u root
 
update mysql.user set password=PASSWORD('...') where User='root' and host='localhost';
 
flush privileges;

service mysql stop
service mysqld start