- 首先修改mysql的登陆设置
# vi /etc/my.cnf
- 重新启动mysql
# /etc/init.d/mysqld restart ( service mysqld restart )
- 登陆并修改root密码
# mysql
mysql> USE mysql;
mysql> UPDATE user SET Password = password ( 'new-password' ) WHERE User = 'root' ;
mysql> flush privileges ;
mysql> quit
- 还原登录设置
# vi /etc/my.cnf
将刚才在[mysqld]的段中加上的skip-grant-tables删除,保存退出
- 重启mysql
# /etc/init.d/mysqld restart ( service mysqld restart )
网友评论