systemctl stop mysql
find / -name my*.cnf
(找到my.cnf文件)
vim /usr/my.cnf
在my.cnf文件的[mysqld]下添加
skip-grant-tables
保存文件
systemctl start mysql
mysql -u root
输入update mysql.user set password=password(‘root’) where user=’root’时提示ERROR 1054 (42S22): Unknown column ‘password’ in ‘field list’
原来是mysql数据库下已经没有password这个字段了,password字段改成了 authentication_string
所以更改语句替换为update mysql.user set authentication_string=password(‘root’) where user=’root’ ;即可
flush privileges;
exit;
systemctl restart mysql