标签:
sudo vi /etc/mysql/my.cnf
添加在[mysqld]的段中加上一句:skip-grant-tables
例如:
[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
skip-grant-tables
sudo service mysql restart
mysql -uroot -p
(或者直接mysql)
首先登录MySQL。
mysql> use mysql;
mysql> update user set password=password(‘123‘) where user=‘root‘ and host=‘localhost‘;
mysql> flush privileges;
标签:
原文地址:http://www.cnblogs.com/oracleloyal/p/5059815.html