I resized an Azure VM and now the MySQL DB running in Windows inside the VM is dead. I am seeing the below fatal error on startup. I tried to run mysql_upgrade as it suggests but that just errors out saying it cannot connect. Does anyone have any ideas on how to fix this?
2016-07-12T09:59:48.426367Z 0 [Note] Server hostname (bind-address): '*'; port: 3306
2016-07-12T09:59:48.426367Z 0 [Note] IPv6 is available.
2016-07-12T09:59:48.426367Z 0 [Note] - '::' resolves to '::';
2016-07-12T09:59:48.426367Z 0 [Note] Server socket created on IP: '::'.
2016-07-12T09:59:48.426367Z 0 [Note] Shared memory setting up listener
2016-07-12T09:59:48.438315Z 0 [Note] InnoDB: Loading buffer pool(s) from C:\ProgramData\MySQL\MySQL Server 5.7\Data\ib_buffer_pool
2016-07-12T09:59:48.455584Z 0 [Note] InnoDB: Buffer pool(s) load completed at 160712 9:59:48
2016-07-12T09:59:48.455584Z 0 [ERROR] Fatal error: mysql.user table is damaged. Please run mysql_upgrade.
2016-07-12T09:59:48.455584Z 0 [ERROR] Aborting
Finally solved! This worked for me :
/etc/init.d/mysqld start --skip-grant-tables && mysql_upgrade
Once the upgrade is successful, you do this:
/etc/init.d/mysqld restart
Or, you can stop and start mysqld seperately.I had been locked in mysql errors from yesterday on Centos 6.
This really saves your day if you installed a different version of mysql on your system while the system already had another version of mysql installed on it. It's very much likely to get different sorts of errors in this situation.
--skip-grant-tables can come in handy to unlock you out of this situation. If you have some security concerns, check this : link on how to use this option with security.
More details on --skip-grant-tables: This enables anyone to connect without a password and with all privileges, and disables account-management statements such as ALTER USER and SET PASSWORD. Source: Click here to learn more on skip grant from official mysql site
Kruthika
Another flag the mysql upgrade documentation doesn't fully mention, is:
--force
.In my past upgrades, a failing
/mysql_upgrade -u root -p
command showed this notice:If the
skip-grant-tables
option fails, as if often does for me on Mac OS X... The last resort is to force upgrade all tables with:./mysql_upgrade -u root -p --force
.In addition to
ALTER TABLE
orREPAIR TABLE
afterwards, to ensure all tables are fully rebuilt.