Reputation: 1
When starting a mysql deployment on OpenShift V3 I get the following exception:
mysql.user table is damaged. Please run mysql_upgrade
I cannot run mysql_upgrade
as pod isn't ready.
I have the following questions
Upvotes: 0
Views: 293
Reputation: 1400
If the pod won't start, you can mount the volume with your data to another pod and download (oc rsync
, interactive tutorial here) what you had mounted in the database pod under /var/lib/mysql/data/
. Then, you can try recovering the data from that.
Generally, this could happen if you process an older database dump sql
script (created using mysqldump
) on a newer MySQL version. In that case, chances are the root
user was removed from the table too (if it was not in the old database). If you created such a dump, still have the older dump, and it's "good enough", you should be able to proceed as follows to import the original data again and prevent this situation:
mysqldump
from the older MySQL database version, so that you can always get back to it, if things go south.sql
file and remove all the content that manipulates the mysql.user
table; that is, delete lines under the -- Table structure for table 'user'
and -- Dumping data for table 'user'
sections and save the modified file. I assume here that you have your user and password specified in environment variables, in the MySQL deployment configuration).sql
dump file created in step 2 (that is, the one not affecting the mysql.user
table) to the database pod using oc rsync
.GRANT ALL PRIVILEGES ON <database> TO '<mysql_user>'@'%'
(Replace <database>
and <mysql_user>
appropriately.)mysql_upgrade -u root
in the shell.Upvotes: 1