mysql8忘记了root密码,需要修改
步奏:
1. 从/etc/my.cnf 配置文件中加入skip-grant-table后正常登陆,把 localhost和user=root 的 authentication_string设置为空字符串
# systemctl restart mysqld
# mysql -u root -p
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
Database changed
mysql> update user set authentication_string='' where user='root';
mysql> select Host,User,authentication_string from user;
+-----------+------------------+------------------------------------------------------------------------+
| Host | User | authentication_string |
+-----------+------------------+------------------------------------------------------------------------+
| localhost | mysql.infoschema | $A$005$THISISACOMBIN