mysql.user table is damaged. Please run mysql_upgrade

  • A+
Categories:Linux MySQL

I have forgot why I upgraded my blog to PHP7 and MySQL5.7, but I just did it.

First have to say, even I had no upgrade plan for such thing. At that time I thought I could upgrade the MySQL rpm to 5.7, then started MySQL database and it should upgrade my database automatically. The worse thing was that I upgraded the PHP to version 7 at the same time, and some modules were not installed at the beginning.

After the upgrade, I rebooted the server and tried to access my website, while just got a blank page. From the log of Nginx, I found the socket file was changed after the php-fpm update, then I changed it accordingly. While still got blank page, and from the error log of php-fpm, I found the json extension of PHP was not installed, so I installed it and some other extensions, then restarted the php-fpm service, and got an error message that the database could not be connected.

From the log of mysql service, I got the error like the title of this blog. So after the upgrade, the mysqld could not be started. I searched and this one saved me:

MySQLd doesn't start after brew upgrade from 5.6 to 5.7

So the steps to fix this issue are easy:

I post the log of command '/usr/bin/mysql_upgrade' as below:

When I restarted mysql service, finally I could open my website again.

One more thing was about the W3TC plugin. When I wanted to change the cache service to others, I always got error message that it could not create directory under wp-content/cache folder. I confirmed the nginx user had read and write permissions of this folder but I still got the error. I could not find any error log about it, so at last I had to grant the 777 to the cache folder, then I found a tmp directory was created and the user name was php-fpm. So I knew I should grant write permission to php-fpm user, and this could be finished by 'setfacl -m u:php-fpm:rwx cache'.

Finally I got an error-free WordPress blog, but I needed to upgrade the wiki part. :(

OK, let me have a rest, and upgrade it in another day.



:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen: