重置Mysql的root密码

1
2
3
4
5
6
7
service mysql restart  --skip-grant-tables
mysql -u root -ppwd <<EOF
use mysql
update user set password=password("新密码") where user="root";
flush privileges;
EOF
service mysql restart