1.停止mysql服务:service mysqld stop; 2. mysqld_safe --skip-grant-tables 3. 重新打一个开个ssh连接(即重新打一个新的黑色窗口); 4.输入以下命令: [ root@localhost ~]# mysql mysqluse mysql mysqlupdate user set password=password(123456) where
1.停止mysql服务:service mysqld stop;
2. mysqld_safe --skip-grant-tables
3. 重新打一个开个ssh连接(即重新打一个新的黑色窗口);
4.输入以下命令:
[ root@localhost ~]# mysql
mysql>use mysql
mysql>update user set password=password(123456) where user=root;
mysql>flush privileges;
mysql>exit
pkill -kill -t pts/0 可将pts为0的**用户(之前运行mysqld_safe的用户窗口)强制踢出
正常启动 mysql:service mysql start.