Recent crash (RAID controller cache failure) made me re-create the MySQL system databases and tables for some were missing. I run MySQL 5.7 on Ubuntu 20.04.

2023-03-10T19:06:19.363955Z 0 [ERROR] --initialize specified but the data directory has files in it. Aborting.
2023-03-10T19:06:19.363976Z 0 [ERROR] Aborting

What is expected here? I back up the data dir, delete everything in it, run mysqld --initialize again then move the backed up dir except mysql, sys and *_schema folders? It is a prod server. Not willing to risk it. Getting errors like

>     2023-03-10T17:39:19.903280Z 75805 [ERROR] InnoDB: Fetch of persistent statistics requested for table database_name.table_name but
> the required system tables mysql.innodb_table_stats and
> mysql.innodb_index_stats are not present or have unexpected structure.
> Using transient stats instead.

servers table is missing from mysql database (mysql.servers) and who knows what else... I remember mysql database had 31 tables. Now has 12!?

enter image description here



Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy