1、關閉所有以mysql連接配接的服務,如httpd
2、vim /etc/my.cnf
#user=mysql 注釋
skip-grant-tables 添加
3、重新開機mysql服務并登陸
#service mysqld restart
#mysql
mysql> use mysql;
mysql> UPDATE user SET Password = password ( '新密碼' ) WHERE User = 'root';
1、關閉所有以mysql連接配接的服務,如httpd
2、vim /etc/my.cnf
#user=mysql 注釋
skip-grant-tables 添加
3、重新開機mysql服務并登陸
#service mysqld restart
#mysql
mysql> use mysql;
mysql> UPDATE user SET Password = password ( '新密碼' ) WHERE User = 'root';