重置密码
关闭正在运行的 MySQL :
service mysqld stop
运行
mysqld_safe --skip-grant-tables &
为了安全可以这样禁止远程连接:
mysqld_safe --skip-grant-tables --skip-networking &
使用mysql连接server:
mysql -p
提示输入密码 回车即可
更改密码:
mysql> update mysql.user set authentication_string=password('centos') where user='root' and Host = 'localhost';