sudo /etc/init.d/mysql stop
sudo mysqld_safe --user=mysql --skip-grant-tables --skip-networking
mysql -uroot -p
输入自己mysql密码
mysql> use mysql;
Reading table information for completion of table and column
names
You can turn off this feature to get a quicker startup with
-A
mysql> update user set Password = PASSWORD(‘root‘) where
User =‘root‘;
Query OK, 3 rows affected (0.00 sec)
Rows matched: 3 Changed:
3 Warnings: 0
【注意!!括号里面的root修改为自己实际的密码】
mysql> exit;
sudo /etc/init.d/mysql restart
时间: 2024-10-14 18:39:42