MySQL 崩溃,日志有很多错误,数据库可能已损坏

MySQL 崩溃,日志有很多错误,数据库可能已损坏

我在 Digital Ocean 上运行一个 LAMP 服务器,上面安装了 WordPress,用于朋友的网站。我最近将它从 AWS 转移过来。它崩溃了,我收到了屏幕Error establishing database connection。我发现 MySQL 停止运行,所以我重新启动了它。该网站现在可以正常工作,但我担心它会再次崩溃。

以下是日志:

2019-02-11T12:46:04.647354Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2019-02-11T12:46:04.658710Z 0 [Note] /usr/sbin/mysqld (mysqld 5.7.25-0ubuntu0.18.04.2) starting as process 13178 ...
2019-02-11T12:46:04.683378Z 0 [Note] InnoDB: PUNCH HOLE support available
2019-02-11T12:46:04.683423Z 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2019-02-11T12:46:04.683429Z 0 [Note] InnoDB: Uses event mutexes
2019-02-11T12:46:04.683434Z 0 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier
2019-02-11T12:46:04.683451Z 0 [Note] InnoDB: Compressed tables use zlib 1.2.11
2019-02-11T12:46:04.683484Z 0 [Note] InnoDB: Using Linux native AIO
2019-02-11T12:46:04.684680Z 0 [Note] InnoDB: Number of pools: 1
2019-02-11T12:46:04.688086Z 0 [Note] InnoDB: Using CPU crc32 instructions
2019-02-11T12:46:04.701706Z 0 [Note] InnoDB: Initializing buffer pool, total size = 128M, instances = 1, chunk size = 128M
2019-02-11T12:46:04.704353Z 0 [ERROR] InnoDB: mmap(137428992 bytes) failed; errno 12
2019-02-11T12:46:04.704377Z 0 [ERROR] InnoDB: Cannot allocate memory for the buffer pool
2019-02-11T12:46:04.704385Z 0 [ERROR] InnoDB: Plugin initialization aborted with error Generic error
2019-02-11T12:46:04.704394Z 0 [ERROR] Plugin 'InnoDB' init function returned error.
2019-02-11T12:46:04.704400Z 0 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
2019-02-11T12:46:04.704412Z 0 [ERROR] Failed to initialize builtin plugins.
2019-02-11T12:46:04.704417Z 0 [ERROR] Aborting

2019-02-11T12:46:04.709129Z 0 [Note] Binlog end
2019-02-11T12:46:04.709197Z 0 [Note] Shutting down plugin 'CSV'
2019-02-11T12:46:04.709559Z 0 [Note] /usr/sbin/mysqld: Shutdown complete

2019-02-11T12:46:05.385154Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2019-02-11T12:46:05.387281Z 0 [Note] /usr/sbin/mysqld (mysqld 5.7.25-0ubuntu0.18.04.2) starting as process 13213 ...
2019-02-11T12:46:05.400665Z 0 [Note] InnoDB: PUNCH HOLE support available
2019-02-11T12:46:05.400710Z 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2019-02-11T12:46:05.400716Z 0 [Note] InnoDB: Uses event mutexes
2019-02-11T12:46:05.400722Z 0 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier
2019-02-11T12:46:05.400727Z 0 [Note] InnoDB: Compressed tables use zlib 1.2.11
2019-02-11T12:46:05.400732Z 0 [Note] InnoDB: Using Linux native AIO
2019-02-11T12:46:05.401035Z 0 [Note] InnoDB: Number of pools: 1
2019-02-11T12:46:05.401165Z 0 [Note] InnoDB: Using CPU crc32 instructions
2019-02-11T12:46:05.405573Z 0 [Note] InnoDB: Initializing buffer pool, total size = 128M, instances = 1, chunk size = 128M
2019-02-11T12:46:05.405629Z 0 [ERROR] InnoDB: mmap(137428992 bytes) failed; errno 12
2019-02-11T12:46:05.405641Z 0 [ERROR] InnoDB: Cannot allocate memory for the buffer pool
2019-02-11T12:46:05.405647Z 0 [ERROR] InnoDB: Plugin initialization aborted with error Generic error
2019-02-11T12:46:05.405654Z 0 [ERROR] Plugin 'InnoDB' init function returned error.
2019-02-11T12:46:05.405659Z 0 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
2019-02-11T12:46:05.405665Z 0 [ERROR] Failed to initialize builtin plugins.
2019-02-11T12:46:05.405669Z 0 [ERROR] Aborting

2019-02-11T12:46:05.417138Z 0 [Note] Binlog end
2019-02-11T12:46:05.417206Z 0 [Note] Shutting down plugin 'CSV'
2019-02-11T12:46:05.417535Z 0 [Note] /usr/sbin/mysqld: Shutdown complete

2019-02-11T12:46:06.132732Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2019-02-11T12:46:06.134944Z 0 [Note] /usr/sbin/mysqld (mysqld 5.7.25-0ubuntu0.18.04.2) starting as process 13252 ...
2019-02-11T12:46:06.148774Z 0 [Note] InnoDB: PUNCH HOLE support available
2019-02-11T12:46:06.148814Z 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2019-02-11T12:46:06.150943Z 0 [Note] InnoDB: Uses event mutexes
2019-02-11T12:46:06.150956Z 0 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier
2019-02-11T12:46:06.150962Z 0 [Note] InnoDB: Compressed tables use zlib 1.2.11
2019-02-11T12:46:06.150967Z 0 [Note] InnoDB: Using Linux native AIO
2019-02-11T12:46:06.151245Z 0 [Note] InnoDB: Number of pools: 1
2019-02-11T12:46:06.151365Z 0 [Note] InnoDB: Using CPU crc32 instructions
2019-02-11T12:46:06.153460Z 0 [Note] InnoDB: Initializing buffer pool, total size = 128M, instances = 1, chunk size = 128M
2019-02-11T12:46:06.153515Z 0 [ERROR] InnoDB: mmap(137428992 bytes) failed; errno 12
2019-02-11T12:46:06.153525Z 0 [ERROR] InnoDB: Cannot allocate memory for the buffer pool
2019-02-11T12:46:06.153531Z 0 [ERROR] InnoDB: Plugin initialization aborted with error Generic error
2019-02-11T12:46:06.153538Z 0 [ERROR] Plugin 'InnoDB' init function returned error.
2019-02-11T12:46:06.153543Z 0 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
2019-02-11T12:46:06.153549Z 0 [ERROR] Failed to initialize builtin plugins.
2019-02-11T12:46:06.153554Z 0 [ERROR] Aborting

2019-02-11T12:46:06.164914Z 0 [Note] Binlog end
2019-02-11T12:46:06.164990Z 0 [Note] Shutting down plugin 'CSV'
2019-02-11T12:46:06.165331Z 0 [Note] /usr/sbin/mysqld: Shutdown complete

2019-02-11T12:46:06.886427Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2019-02-11T12:46:06.892617Z 0 [Note] /usr/sbin/mysqld (mysqld 5.7.25-0ubuntu0.18.04.2) starting as process 13291 ...
2019-02-11T12:46:06.927400Z 0 [Note] InnoDB: PUNCH HOLE support available
2019-02-11T12:46:06.927480Z 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2019-02-11T12:46:06.927489Z 0 [Note] InnoDB: Uses event mutexes
2019-02-11T12:46:06.927495Z 0 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier
2019-02-11T12:46:06.927500Z 0 [Note] InnoDB: Compressed tables use zlib 1.2.11
2019-02-11T12:46:06.927505Z 0 [Note] InnoDB: Using Linux native AIO
2019-02-11T12:46:06.932089Z 0 [Note] InnoDB: Number of pools: 1
2019-02-11T12:46:06.932332Z 0 [Note] InnoDB: Using CPU crc32 instructions
2019-02-11T12:46:06.960416Z 0 [Note] InnoDB: Initializing buffer pool, total size = 128M, instances = 1, chunk size = 128M
2019-02-11T12:46:06.960486Z 0 [ERROR] InnoDB: mmap(137428992 bytes) failed; errno 12
2019-02-11T12:46:06.960497Z 0 [ERROR] InnoDB: Cannot allocate memory for the buffer pool
2019-02-11T12:46:06.960503Z 0 [ERROR] InnoDB: Plugin initialization aborted with error Generic error
2019-02-11T12:46:06.960513Z 0 [ERROR] Plugin 'InnoDB' init function returned error.
2019-02-11T12:46:06.960519Z 0 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
2019-02-11T12:46:06.960525Z 0 [ERROR] Failed to initialize builtin plugins.
2019-02-11T12:46:06.960530Z 0 [ERROR] Aborting

2019-02-11T12:46:06.968342Z 0 [Note] Binlog end
2019-02-11T12:46:06.968413Z 0 [Note] Shutting down plugin 'CSV'
2019-02-11T12:46:06.968749Z 0 [Note] /usr/sbin/mysqld: Shutdown complete

2019-02-11T12:46:07.630976Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2019-02-11T12:46:07.637157Z 0 [Note] /usr/sbin/mysqld (mysqld 5.7.25-0ubuntu0.18.04.2) starting as process 13330 ...
2019-02-11T12:46:07.646460Z 0 [Note] InnoDB: PUNCH HOLE support available
2019-02-11T12:46:07.646495Z 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2019-02-11T12:46:07.646501Z 0 [Note] InnoDB: Uses event mutexes
2019-02-11T12:46:07.646506Z 0 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier
2019-02-11T12:46:07.646512Z 0 [Note] InnoDB: Compressed tables use zlib 1.2.11
2019-02-11T12:46:07.646517Z 0 [Note] InnoDB: Using Linux native AIO
2019-02-11T12:46:07.646820Z 0 [Note] InnoDB: Number of pools: 1
2019-02-11T12:46:07.646953Z 0 [Note] InnoDB: Using CPU crc32 instructions
2019-02-11T12:46:07.657012Z 0 [Note] InnoDB: Initializing buffer pool, total size = 128M, instances = 1, chunk size = 128M
2019-02-11T12:46:07.657071Z 0 [ERROR] InnoDB: mmap(137428992 bytes) failed; errno 12
2019-02-11T12:46:07.657082Z 0 [ERROR] InnoDB: Cannot allocate memory for the buffer pool
2019-02-11T12:46:07.657088Z 0 [ERROR] InnoDB: Plugin initialization aborted with error Generic error
2019-02-11T12:46:07.657096Z 0 [ERROR] Plugin 'InnoDB' init function returned error.
2019-02-11T12:46:07.657101Z 0 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
2019-02-11T12:46:07.657108Z 0 [ERROR] Failed to initialize builtin plugins.
2019-02-11T12:46:07.657112Z 0 [ERROR] Aborting

2019-02-11T12:46:07.664501Z 0 [Note] Binlog end
2019-02-11T12:46:07.664568Z 0 [Note] Shutting down plugin 'CSV'
2019-02-11T12:46:07.664907Z 0 [Note] /usr/sbin/mysqld: Shutdown complete

2019-02-11T18:30:32.001526Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2019-02-11T18:30:32.008096Z 0 [Note] /usr/sbin/mysqld (mysqld 5.7.25-0ubuntu0.18.04.2) starting as process 15177 ...
2019-02-11T18:30:32.020450Z 0 [Note] InnoDB: PUNCH HOLE support available
2019-02-11T18:30:32.020488Z 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2019-02-11T18:30:32.020495Z 0 [Note] InnoDB: Uses event mutexes
2019-02-11T18:30:32.020501Z 0 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier
2019-02-11T18:30:32.020511Z 0 [Note] InnoDB: Compressed tables use zlib 1.2.11
2019-02-11T18:30:32.020517Z 0 [Note] InnoDB: Using Linux native AIO
2019-02-11T18:30:32.021674Z 0 [Note] InnoDB: Number of pools: 1
2019-02-11T18:30:32.024458Z 0 [Note] InnoDB: Using CPU crc32 instructions
2019-02-11T18:30:32.027778Z 0 [Note] InnoDB: Initializing buffer pool, total size = 128M, instances = 1, chunk size = 128M
2019-02-11T18:30:32.048894Z 0 [Note] InnoDB: Completed initialization of buffer pool
2019-02-11T18:30:32.052604Z 0 [Note] InnoDB: If the mysqld execution user is authorized, page cleaner thread priority can be changed. See the man page of setpriority().
2019-02-11T18:30:32.070698Z 0 [Note] InnoDB: Highest supported file format is Barracuda.
2019-02-11T18:30:32.074927Z 0 [Note] InnoDB: Log scan progressed past the checkpoint lsn 198219821
2019-02-11T18:30:32.074948Z 0 [Note] InnoDB: Doing recovery: scanned up to log sequence number 198219830
2019-02-11T18:30:32.074956Z 0 [Note] InnoDB: Database was not shutdown normally!
2019-02-11T18:30:32.074962Z 0 [Note] InnoDB: Starting crash recovery.
2019-02-11T18:30:32.284797Z 0 [Note] InnoDB: Removed temporary tablespace data file: "ibtmp1"
2019-02-11T18:30:32.284833Z 0 [Note] InnoDB: Creating shared tablespace for temporary tables
2019-02-11T18:30:32.284897Z 0 [Note] InnoDB: Setting file './ibtmp1' size to 12 MB. Physically writing the file full; Please wait ...
2019-02-11T18:30:32.305918Z 0 [Note] InnoDB: File './ibtmp1' size is now 12 MB.
2019-02-11T18:30:32.307124Z 0 [Note] InnoDB: 96 redo rollback segment(s) found. 96 redo rollback segment(s) are active.
2019-02-11T18:30:32.307146Z 0 [Note] InnoDB: 32 non-redo rollback segment(s) are active.
2019-02-11T18:30:32.307448Z 0 [Note] InnoDB: Waiting for purge to start
2019-02-11T18:30:32.357698Z 0 [Note] InnoDB: 5.7.25 started; log sequence number 198219830
2019-02-11T18:30:32.358000Z 0 [Note] InnoDB: Loading buffer pool(s) from /var/lib/mysql/ib_buffer_pool
2019-02-11T18:30:32.358645Z 0 [Note] Plugin 'FEDERATED' is disabled.
2019-02-11T18:30:32.367822Z 0 [Note] InnoDB: Buffer pool(s) load completed at 190211 18:30:32
2019-02-11T18:30:32.372021Z 0 [Warning] Failed to set up SSL because of the following SSL library error: SSL context is not usable without certificate and private key
2019-02-11T18:30:32.372052Z 0 [Note] Server hostname (bind-address): '127.0.0.1'; port: 3306
2019-02-11T18:30:32.372069Z 0 [Note]   - '127.0.0.1' resolves to '127.0.0.1';
2019-02-11T18:30:32.372117Z 0 [Note] Server socket created on IP: '127.0.0.1'.
2019-02-11T18:30:32.374574Z 0 [ERROR] /usr/sbin/mysqld: Table './mysql/user' is marked as crashed and should be repaired
2019-02-11T18:30:32.374807Z 0 [Warning] Checking table:   './mysql/user'
2019-02-11T18:30:32.374828Z 0 [ERROR] 1 client is using or hasn't closed the table properly
2019-02-11T18:30:32.376040Z 0 [ERROR] /usr/sbin/mysqld: Table './mysql/db' is marked as crashed and should be repaired
2019-02-11T18:30:32.376258Z 0 [Warning] Checking table:   './mysql/db'
2019-02-11T18:30:32.376276Z 0 [ERROR] 1 client is using or hasn't closed the table properly
2019-02-11T18:30:32.417495Z 0 [Note] Event Scheduler: Loaded 0 events
2019-02-11T18:30:32.417717Z 0 [Note] /usr/sbin/mysqld: ready for connections.

我查看了一些错误,其中一条建议是设置交换文件。我最初设置服务器时忘记这样做了,但现在已经这样做了。这足以解决所有这些问题吗?

日志表明数据库已崩溃并且应该修复,但是当我运行时mysqlcheck -uroot -p --repair --all-databases,收到一个错误:

警告:请不要修改 gtid_executed 表。这是 mysql 内部系统表,用于存储已提交事务的 GTID。修改它可能会导致不一致的 GTID 状态

此外,几乎所有数据库都会返回

该表的存储引擎不支持修复

我对 MySQL 不是很熟悉,如果能得到一些帮助我将非常感激。

编辑 - *** 这是我在创建交换文件并按照 Pimp Juice IT 的指示复制并重新创建 mysql.user 和 mysql.db 后的 MySql 日志。

2019-02-14T01:11:32.323393Z 0 [Note] /usr/sbin/mysqld (mysqld 5.7.25-0ubuntu0.18.04.2) starting as process 13773 ...
2019-02-14T01:11:32.330267Z 0 [Note] InnoDB: PUNCH HOLE support available
2019-02-14T01:11:32.330314Z 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2019-02-14T01:11:32.330320Z 0 [Note] InnoDB: Uses event mutexes
2019-02-14T01:11:32.330325Z 0 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier
2019-02-14T01:11:32.330331Z 0 [Note] InnoDB: Compressed tables use zlib 1.2.11
2019-02-14T01:11:32.330336Z 0 [Note] InnoDB: Using Linux native AIO
2019-02-14T01:11:32.330711Z 0 [Note] InnoDB: Number of pools: 1
2019-02-14T01:11:32.331148Z 0 [Note] InnoDB: Using CPU crc32 instructions
2019-02-14T01:11:32.335469Z 0 [Note] InnoDB: Initializing buffer pool, total size = 128M, instances = 1, chunk size = 128M
2019-02-14T01:11:32.349062Z 0 [Note] InnoDB: Completed initialization of buffer pool
2019-02-14T01:11:32.351877Z 0 [Note] InnoDB: If the mysqld execution user is authorized, page cleaner thread priority can be changed. See the man page of setpriority().
2019-02-14T01:11:32.367267Z 0 [Note] InnoDB: Highest supported file format is Barracuda.
2019-02-14T01:11:32.398365Z 0 [Note] InnoDB: Creating shared tablespace for temporary tables
2019-02-14T01:11:32.398456Z 0 [Note] InnoDB: Setting file './ibtmp1' size to 12 MB. Physically writing the file full; Please wait ...
2019-02-14T01:11:32.427196Z 0 [Note] InnoDB: File './ibtmp1' size is now 12 MB.
2019-02-14T01:11:32.428313Z 0 [Note] InnoDB: 96 redo rollback segment(s) found. 96 redo rollback segment(s) are active.
2019-02-14T01:11:32.428334Z 0 [Note] InnoDB: 32 non-redo rollback segment(s) are active.
2019-02-14T01:11:32.428694Z 0 [Note] InnoDB: Waiting for purge to start
2019-02-14T01:11:32.478973Z 0 [Note] InnoDB: 5.7.25 started; log sequence number 235030084
2019-02-14T01:11:32.479462Z 0 [Note] Plugin 'FEDERATED' is disabled.
2019-02-14T01:11:32.479792Z 0 [Note] InnoDB: Loading buffer pool(s) from /var/lib/mysql/ib_buffer_pool
2019-02-14T01:11:32.497280Z 0 [Warning] Failed to set up SSL because of the following SSL library error: SSL context is not usable without certificate and private key
2019-02-14T01:11:32.497320Z 0 [Note] Server hostname (bind-address): '127.0.0.1'; port: 3306
2019-02-14T01:11:32.497341Z 0 [Note]   - '127.0.0.1' resolves to '127.0.0.1';
2019-02-14T01:11:32.497378Z 0 [Note] Server socket created on IP: '127.0.0.1'.
2019-02-14T01:11:32.529140Z 0 [Note] InnoDB: Buffer pool(s) load completed at 190214  1:11:32
2019-02-14T01:11:32.551263Z 0 [Note] Event Scheduler: Loaded 0 events
2019-02-14T01:11:32.551501Z 0 [Note] /usr/sbin/mysqld: ready for connections.
Version: '5.7.25-0ubuntu0.18.04.2'  socket: '/var/run/mysqld/mysqld.sock'  port: 3306  (Ubuntu)
2019-02-14T01:12:57.820655Z 7 [Note] Access denied for user 'ryan'@'localhost' (using password: NO)
2019-02-14T01:15:49.115479Z 0 [Note] Giving 0 client threads a chance to die gracefully
2019-02-14T01:15:49.115520Z 0 [Note] Shutting down slave threads
2019-02-14T01:15:49.115529Z 0 [Note] Forcefully disconnecting 0 remaining clients
2019-02-14T01:15:49.115537Z 0 [Note] Event Scheduler: Purging the queue. 0 events
2019-02-14T01:15:49.115660Z 0 [Note] Binlog end
2019-02-14T01:15:49.117415Z 0 [Note] Shutting down plugin 'auth_socket'
2019-02-14T01:15:49.117434Z 0 [Note] Shutting down plugin 'ngram'
2019-02-14T01:15:49.117438Z 0 [Note] Shutting down plugin 'partition'
2019-02-14T01:15:49.117443Z 0 [Note] Shutting down plugin 'BLACKHOLE'
2019-02-14T01:15:49.117448Z 0 [Note] Shutting down plugin 'ARCHIVE'
2019-02-14T01:15:49.117464Z 0 [Note] Shutting down plugin 'PERFORMANCE_SCHEMA'
2019-02-14T01:15:49.117501Z 0 [Note] Shutting down plugin 'MRG_MYISAM'
2019-02-14T01:15:49.117506Z 0 [Note] Shutting down plugin 'MyISAM'
2019-02-14T01:15:49.117513Z 0 [Note] Shutting down plugin 'INNODB_SYS_VIRTUAL'
2019-02-14T01:15:49.117517Z 0 [Note] Shutting down plugin 'INNODB_SYS_DATAFILES'
2019-02-14T01:15:49.117521Z 0 [Note] Shutting down plugin 'INNODB_SYS_TABLESPACES'
2019-02-14T01:15:49.117524Z 0 [Note] Shutting down plugin 'INNODB_SYS_FOREIGN_COLS'
2019-02-14T01:15:49.117527Z 0 [Note] Shutting down plugin 'INNODB_SYS_FOREIGN'
2019-02-14T01:15:49.117531Z 0 [Note] Shutting down plugin 'INNODB_SYS_FIELDS'
2019-02-14T01:15:49.117534Z 0 [Note] Shutting down plugin 'INNODB_SYS_COLUMNS'
2019-02-14T01:15:49.117537Z 0 [Note] Shutting down plugin 'INNODB_SYS_INDEXES'
2019-02-14T01:15:49.117540Z 0 [Note] Shutting down plugin 'INNODB_SYS_TABLESTATS'
2019-02-14T01:15:49.117544Z 0 [Note] Shutting down plugin 'INNODB_SYS_TABLES'
2019-02-14T01:15:49.117547Z 0 [Note] Shutting down plugin 'INNODB_FT_INDEX_TABLE'
2019-02-14T01:15:49.117550Z 0 [Note] Shutting down plugin 'INNODB_FT_INDEX_CACHE'
2019-02-14T01:15:49.117553Z 0 [Note] Shutting down plugin 'INNODB_FT_CONFIG'
2019-02-14T01:15:49.117557Z 0 [Note] Shutting down plugin 'INNODB_FT_BEING_DELETED'
2019-02-14T01:15:49.117560Z 0 [Note] Shutting down plugin 'INNODB_FT_DELETED'
2019-02-14T01:15:49.117563Z 0 [Note] Shutting down plugin 'INNODB_FT_DEFAULT_STOPWORD'
2019-02-14T01:15:49.117566Z 0 [Note] Shutting down plugin 'INNODB_METRICS'
2019-02-14T01:15:49.117570Z 0 [Note] Shutting down plugin 'INNODB_TEMP_TABLE_INFO'
2019-02-14T01:15:49.117573Z 0 [Note] Shutting down plugin 'INNODB_BUFFER_POOL_STATS'
2019-02-14T01:15:49.117576Z 0 [Note] Shutting down plugin 'INNODB_BUFFER_PAGE_LRU'
2019-02-14T01:15:49.117580Z 0 [Note] Shutting down plugin 'INNODB_BUFFER_PAGE'
2019-02-14T01:15:49.117583Z 0 [Note] Shutting down plugin 'INNODB_CMP_PER_INDEX_RESET'
2019-02-14T01:15:49.117586Z 0 [Note] Shutting down plugin 'INNODB_CMP_PER_INDEX'
2019-02-14T01:15:49.117590Z 0 [Note] Shutting down plugin 'INNODB_CMPMEM_RESET'
2019-02-14T01:15:49.117593Z 0 [Note] Shutting down plugin 'INNODB_CMPMEM'
2019-02-14T01:15:49.117596Z 0 [Note] Shutting down plugin 'INNODB_CMP_RESET'
2019-02-14T01:15:49.117599Z 0 [Note] Shutting down plugin 'INNODB_CMP'
2019-02-14T01:15:49.117603Z 0 [Note] Shutting down plugin 'INNODB_LOCK_WAITS'
2019-02-14T01:15:49.117606Z 0 [Note] Shutting down plugin 'INNODB_LOCKS'
2019-02-14T01:15:49.117609Z 0 [Note] Shutting down plugin 'INNODB_TRX'
2019-02-14T01:15:49.117613Z 0 [Note] Shutting down plugin 'InnoDB'
2019-02-14T01:15:49.122626Z 0 [Note] InnoDB: FTS optimize thread exiting.
2019-02-14T01:15:49.122808Z 0 [Note] InnoDB: Starting shutdown...
2019-02-14T01:15:49.223291Z 0 [Note] InnoDB: Dumping buffer pool(s) to /var/lib/mysql/ib_buffer_pool
2019-02-14T01:15:49.223542Z 0 [Note] InnoDB: Buffer pool(s) dump completed at 190214  1:15:49
2019-02-14T01:15:50.436146Z 0 [Note] InnoDB: Shutdown completed; log sequence number 235125993
2019-02-14T01:15:50.439129Z 0 [Note] InnoDB: Removed temporary tablespace data file: "ibtmp1"
2019-02-14T01:15:50.439170Z 0 [Note] Shutting down plugin 'MEMORY'
2019-02-14T01:15:50.439181Z 0 [Note] Shutting down plugin 'CSV'
2019-02-14T01:15:50.439190Z 0 [Note] Shutting down plugin 'sha256_password'
2019-02-14T01:15:50.439195Z 0 [Note] Shutting down plugin 'mysql_native_password'
2019-02-14T01:15:50.439475Z 0 [Note] Shutting down plugin 'binlog'
2019-02-14T01:15:50.440036Z 0 [Note] /usr/sbin/mysqld: Shutdown complete

2019-02-14T01:15:50.777735Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2019-02-14T01:15:50.779938Z 0 [Note] /usr/sbin/mysqld (mysqld 5.7.25-0ubuntu0.18.04.2) starting as process 14025 ...
2019-02-14T01:15:50.785356Z 0 [Note] InnoDB: PUNCH HOLE support available
2019-02-14T01:15:50.785392Z 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2019-02-14T01:15:50.785409Z 0 [Note] InnoDB: Uses event mutexes
2019-02-14T01:15:50.785415Z 0 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier
2019-02-14T01:15:50.785420Z 0 [Note] InnoDB: Compressed tables use zlib 1.2.11
2019-02-14T01:15:50.785425Z 0 [Note] InnoDB: Using Linux native AIO
2019-02-14T01:15:50.785730Z 0 [Note] InnoDB: Number of pools: 1
2019-02-14T01:15:50.785867Z 0 [Note] InnoDB: Using CPU crc32 instructions
2019-02-14T01:15:50.790011Z 0 [Note] InnoDB: Initializing buffer pool, total size = 128M, instances = 1, chunk size = 128M
2019-02-14T01:15:50.800479Z 0 [Note] InnoDB: Completed initialization of buffer pool
2019-02-14T01:15:50.803193Z 0 [Note] InnoDB: If the mysqld execution user is authorized, page cleaner thread priority can be changed. See the man page of setpriority().
2019-02-14T01:15:50.815660Z 0 [Note] InnoDB: Highest supported file format is Barracuda.
2019-02-14T01:15:50.832348Z 0 [Note] InnoDB: Creating shared tablespace for temporary tables
2019-02-14T01:15:50.832440Z 0 [Note] InnoDB: Setting file './ibtmp1' size to 12 MB. Physically writing the file full; Please wait ...
2019-02-14T01:15:50.852215Z 0 [Note] InnoDB: File './ibtmp1' size is now 12 MB.
2019-02-14T01:15:50.853258Z 0 [Note] InnoDB: 96 redo rollback segment(s) found. 96 redo rollback segment(s) are active.
2019-02-14T01:15:50.853278Z 0 [Note] InnoDB: 32 non-redo rollback segment(s) are active.
2019-02-14T01:15:50.853589Z 0 [Note] InnoDB: Waiting for purge to start
2019-02-14T01:15:50.903857Z 0 [Note] InnoDB: 5.7.25 started; log sequence number 235125993
2019-02-14T01:15:50.904272Z 0 [Note] Plugin 'FEDERATED' is disabled.
2019-02-14T01:15:50.910678Z 0 [Warning] Failed to set up SSL because of the following SSL library error: SSL context is not usable without certificate and private key
2019-02-14T01:15:50.910702Z 0 [Note] Server hostname (bind-address): '127.0.0.1'; port: 3306
2019-02-14T01:15:50.910720Z 0 [Note]   - '127.0.0.1' resolves to '127.0.0.1';
2019-02-14T01:15:50.910755Z 0 [Note] Server socket created on IP: '127.0.0.1'.
2019-02-14T01:15:50.911679Z 0 [Note] InnoDB: Loading buffer pool(s) from /var/lib/mysql/ib_buffer_pool
2019-02-14T01:15:50.914945Z 0 [Note] InnoDB: Buffer pool(s) load completed at 190214  1:15:50
2019-02-14T01:15:50.923429Z 0 [Note] Event Scheduler: Loaded 0 events
2019-02-14T01:15:50.923699Z 0 [Note] /usr/sbin/mysqld: ready for connections.
Version: '5.7.25-0ubuntu0.18.04.2'  socket: '/var/run/mysqld/mysqld.sock'  port: 3306  (Ubuntu)

我认为现在一切都好了。这可能只是内存问题。感谢 Pimp Juice IT。

答案1

MySQL 启动选项

如果即使错误消息表明表已崩溃,您仍可以连接到 MySQL 实例,那么您可以将数据从现有表复制到暂存表,截断原始系统表,然后将记录从暂存表加载插回到原始表中。

复制并重新创建 mysql.user 表

create table mysql.new_user like mysql.user;
insert mysql.new_user select * from mysql.user;
truncate table mysql.user;
insert mysql.user select * from mysql.new_user;

复制并重新创建 mysql.db 表

create table mysql.new_db like mysql.db;
insert mysql.new_db select * from mysql.db;
truncate table mysql.db;
insert mysql.db select * from mysql.new_db;

笔记:此选项 1 的答案受到以下启发:如何修复 InnoDB 表?建议


MySQL 无法启动选项

根据一些评论强制InnoDB恢复人们说,在重新启动服务器之前在选项文件的部分innodb_force_recovery = 1中进行设置将允许您在服务器无法完全启动时启动它。[mysqld]my.cnf

一旦启动了 MySQL,就可以运行MySQL 启动选项如我上面列出的 SQL 语句,删除innodb_force_recovery = 1之后的或将其设置回更改之前的值,然后重新启动 MySQL 服务并查看它是否解决了损坏的表数据问题。

当您以该模式启动 MySQL 服务时,要尝试的另一件事innodb_force_recovery = 1是导出或备份损坏的表(或所有数据库),然后删除该innodb_force_recovery = 1选项并重新启动 MySQL 并查看会发生什么。


如果一切都失败了

您随时可以从 AWS 传输此系统的另一个副本,当您准备从全新的 AWS 传输开始时,请确保在启动 MySQL 服务之前已相应地配置了交换文件设置。

最后但同样重要的是,你可以随时从最新的系统恢复系统MySQL 备份文件等


奖金

我相信这只适用于MyISAM数据库引擎 MySQL 实例,但以防万一,或者有人正在寻找这样的解决方案

在一个 cmd 窗口中...

mysqld –-console –-skip-grant-tables –-skip-external-locking 

在另一个 ...

mysqlcheck –repair mysql user 

如果失败,您可能必须从备份中恢复 mysql db。

无论哪种方法解决问题后,发出 mysqladmin shutdown 并正常重新启动 mysql 服务器。

来源

我相信该--console选项仅适用于 Windows,因此如果您遇到问题,只需从命令中省略它并改用mysqld –-skip-grant-tables –-skip-external-locking


更多资源

相关内容