ubuntu 18下重置 MySQL 的密码
2020年5月29日1.编辑配置文件 ,添加skip-grant-tables
/etc/mysql/mysql.conf.d/mysqld.cnf
2.重启mysql
sudo service mysql restart
3重置密码
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
mysql mysql> use mysql Database changed mysql> update mysql.user set authentication_string=password('123qwe') where user='root' and Host ='localhost'; Query OK, 0 rows affected (0.00 sec) Rows matched: 4 Changed: 0 Warnings: 0 mysql>update user set plugin="mysql_native_password"; mysql>flush privileges; mysql>quit; |
4.编辑配置文件 ,删除skip-grant-tables
,重启mysql
5. 再次登录
mysql>mysql -u root -p