我有一个 mysql galera 服务器(innodb)数据目录,由于网络故障而崩溃。我正在尝试通过文件系统恢复数据库。尝试了 innodb_force_recovery flag 1 ,
[mysqld]
innodb_force_recovery = 1
启动数据库
/etc/init.d/mysql start
数据库已启动,但日志显示错误。
2022-03-04 11:07:08 139852880054528 [ERROR] mysqld: Table './mysql/user' is marked as crashed and should be repaired
2022-03-04 11:07:08 139852880054528 [Warning] Checking table: './mysql/user'
2022-03-04 11:07:08 139852880054528 [ERROR] mysql.user: 1 client is using or hasn't closed the table properly
2022-03-04 11:07:08 139852880054528 [ERROR] mysqld: Table './mysql/db' is marked as crashed and should be repaired
2022-03-04 11:07:08 139852880054528 [Warning] Checking table: './mysql/db'
2022-03-04 11:07:08 139852880054528 [ERROR] mysql.db: 1 client is using or hasn't closed the table properly
2022-03-04 11:07:08 139852878686976 [Note] WSREP: wsrep_notify_cmd is not defined, skipping notification.
修好了桌子
bash-4.2$ myisamchk -r --update-state /var/lib/mysql/mysql/user.MYI
- recovering (with sort) MyISAM-table '/var/lib/mysql/mysql/user.MYI'
Data records: 15
- Fixing index 1
bash-4.2$ myisamchk -r --update-state /var/lib/mysql/mysql/db.MYI
- recovering (with sort) MyISAM-table '/var/lib/mysql/mysql/db.MYI'
Data records: 18
- Fixing index 1
- Fixing index 2
重新启动数据库服务器
/etc/init.d/mysql start
数据库服务器即将启动。但仅显示 information_schema 数据库。没有列出其他数据库,甚至没有像 mysql、performance_schema 这样的系统数据库。
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 7
Server version: 10.1.24-MariaDB MariaDB Server
Copyright (c) 2000, 2017, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [(none)]> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
+--------------------+
1 row in set (0.02 sec)
检查了 datadir 和文件夹,一切看起来都不错。流程或不同流程的任何变化以使其正常工作?