mysql忘记root密码

# vim /etc/my.cnf
[mysqld]
#add for free password
skip-grant-tables

# service mysql restart
# mysql
mysql> update mysql.user set password=password("1234abcd") where user='root';
Query OK, 3 rows affected (0.00 sec)
Rows matched: 3  Changed: 3  Warnings: 0

mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)

mysql> exit
Bye
# vim /etc/my.cnf
=>#skip-grant-tables
# service mysqld restart
# mysql -uroot -p1234abcd

 

posted on 2017-12-15 10:06  ln822  阅读(111)  评论(0编辑  收藏  举报