centos7 下报错(ERROR 1558 (HY000): Column count of mysql.user is wrong. Expected 43, found 42. Created)

这是因为系统自带的mysql版本需要更新

按照网上的方法,输入mysql_upgrade -u root -p 123之后,并没有反应

注意刚刚的命令行是在mysql数据库里面输入的,接下来在root下输入 mysql_upgrade -u root -p试试,还是报错,不过这次的报错是个好消息,起码知道问题在哪

# mysql_upgrade -u root -p
Enter password: 
Looking for 'mysql' as: mysql
Looking for 'mysqlcheck' as: mysqlcheck
Error: Failed while fetching Server version! Could be due to unauthorized access.
FATAL ERROR: Upgrade failed
接下来输入命令

 #mysqld --skip-grant-tables

# mysql_upgrade
更新成功

进入mysql数据库, 

service mysqld restart

 mysql -u root

进去之后修改密码:

set password = password('123');

Query OK, 0 rows affected (0.00 sec)
更改密码成功!

你可能感兴趣的:(Linux)