2016-01-08 99 views
0

我安裝了我的strator服務器的完整備份,並且必須使用my.cnf中的「innodb_force_recovery = 1」才能啓動我的數據庫。如何在innodb恢復後重新啓動mysql

我,howewver,無法寫入/更改到數據庫/表,並要求取消註釋「innodb_force_recovery = 1」選項。

Outcommenting後,我無法啓動SQL服務器。任何幫助,將不勝感激。我得到以下堆棧跟蹤:

WITH innodb_force_recovery開始= 1

160108 3:28:04 [Note] Event Scheduler: Loaded 0 events 
160108 3:28:04 [Note] /usr/sbin/mysqld: ready for connections. 
Version: '5.5.38-0ubuntu0.14.04.1' socket: '/var/run/mysqld/mysqld.sock' port: 3306 (Ubuntu) 
160108 3:28:21 [Note] /usr/sbin/mysqld: Normal shutdown 

160108 3:28:21 [Note] Event Scheduler: Purging the queue. 0 events 
160108 3:28:21 InnoDB: Starting shutdown... 
160108 3:28:23 InnoDB: Shutdown completed; log sequence number 946126358 
160108 3:28:23 [Note] /usr/sbin/mysqld: Shutdown complete 

160108 3:28:41 [Warning] Using unique option prefix myisam-recover instead of myisam-recover-options is deprecated and will be removed in a future release. Please use the full name instead. 
160108 3:28:41 [Note] Plugin 'FEDERATED' is disabled. 
160108 3:28:41 [Warning] option 'innodb-buffer-pool-size': signed value 2097152 adjusted to 5242880 
160108 3:28:41 [Warning] option 'innodb-additional-mem-pool-size': signed value 512000 adjusted to 524288 
160108 3:28:41 InnoDB: The InnoDB memory heap is disabled 
160108 3:28:41 InnoDB: Mutexes and rw_locks use GCC atomic builtins 
160108 3:28:41 InnoDB: Compressed tables use zlib 1.2.8 
160108 3:28:41 InnoDB: Using Linux native AIO 
160108 3:28:41 InnoDB: Initializing buffer pool, size = 5.0M 
160108 3:28:41 InnoDB: Completed initialization of buffer pool 
160108 3:28:41 InnoDB: highest supported file format is Barracuda. 
160108 3:28:41 InnoDB: Waiting for the background threads to start 
160108 3:28:42 InnoDB: Error: tablespace size stored in header is 4224 pages, but 
160108 3:28:42 InnoDB: the sum of data file sizes is only 3840 pages 
160108 3:28:42 InnoDB: 5.5.38 started; log sequence number 946126358 
160108 3:28:42 InnoDB: !!! innodb_force_recovery is set to 1 !!! 
160108 3:28:42 [Note] Server hostname (bind-address): '0.0.0.0'; port: 3306 
160108 3:28:42 [Note] - '0.0.0.0' resolves to '0.0.0.0'; 
160108 3:28:42 [Note] Server socket created on IP: '0.0.0.0'. 
160108 3:28:42 [Note] Event Scheduler: Loaded 0 events 
160108 3:28:42 [Note] /usr/sbin/mysqld: ready for connections. 
Version: '5.5.38-0ubuntu0.14.04.1' socket: '/var/run/mysqld/mysqld.sock' port: 3306 (Ubuntu) 

重啓無innodb_force_recovery = 1

160108 3:29:28 [Note] /usr/sbin/mysqld: Normal shutdown 

160108 3:29:28 [Note] Event Scheduler: Purging the queue. 0 events 
160108 3:29:28 InnoDB: Starting shutdown... 
160108 3:29:29 InnoDB: Shutdown completed; log sequence number 946126358 
160108 3:29:29 [Note] /usr/sbin/mysqld: Shutdown complete 

160108 3:29:29 [Warning] Using unique option prefix myisam-recover instead of myisam-recover-options is deprecated and will be removed in a future release. Please use the full name instead. 
160108 3:29:29 [Note] Plugin 'FEDERATED' is disabled. 
160108 3:29:29 [Warning] option 'innodb-buffer-pool-size': signed value 2097152 adjusted to 5242880 
160108 3:29:29 [Warning] option 'innodb-additional-mem-pool-size': signed value 512000 adjusted to 524288 
160108 3:29:29 InnoDB: The InnoDB memory heap is disabled 
160108 3:29:29 InnoDB: Mutexes and rw_locks use GCC atomic builtins 
160108 3:29:29 InnoDB: Compressed tables use zlib 1.2.8 
160108 3:29:29 InnoDB: Using Linux native AIO 
160108 3:29:29 InnoDB: Initializing buffer pool, size = 5.0M 
160108 3:29:29 InnoDB: Completed initialization of buffer pool 
160108 3:29:29 InnoDB: highest supported file format is Barracuda. 
160108 3:29:30 InnoDB: Waiting for the background threads to start 
160108 3:29:31 InnoDB: Error: tablespace size stored in header is 4224 pages, but 
160108 3:29:31 InnoDB: the sum of data file sizes is only 3840 pages 
160108 3:29:31 InnoDB: Cannot start InnoDB. The tail of the system tablespace is 
160108 3:29:31 InnoDB: missing. Have you edited innodb_data_file_path in my.cnf in an 
160108 3:29:31 InnoDB: inappropriate way, removing ibdata files from there? 
160108 3:29:31 InnoDB: You can set innodb_force_recovery=1 in my.cnf to force 
160108 3:29:31 InnoDB: a startup if you are trying to recover a badly corrupt database. 
160108 3:29:31 [ERROR] Plugin 'InnoDB' init function returned error. 
160108 3:29:31 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed. 
160108 3:29:31 [ERROR] Unknown/unsupported storage engine: InnoDB 
160108 3:29:31 [ERROR] Aborting 

160108 3:29:31 [Note] /usr/sbin/mysqld: Shutdown complete 

160108 3:29:32 [Warning] Using unique option prefix myisam-recover instead of myisam-recover-options is deprecated and will be removed in a future release. Please use the full name instead. 
160108 3:29:32 [Note] Plugin 'FEDERATED' is disabled. 
160108 3:29:32 [Warning] option 'innodb-buffer-pool-size': signed value 2097152 adjusted to 5242880 
160108 3:29:32 [Warning] option 'innodb-additional-mem-pool-size': signed value 512000 adjusted to 524288 
160108 3:29:32 InnoDB: The InnoDB memory heap is disabled 
160108 3:29:32 InnoDB: Mutexes and rw_locks use GCC atomic builtins 
160108 3:29:32 InnoDB: Compressed tables use zlib 1.2.8 
160108 3:29:32 InnoDB: Using Linux native AIO 
160108 3:29:32 InnoDB: Initializing buffer pool, size = 5.0M 
160108 3:29:32 InnoDB: Completed initialization of buffer pool 
160108 3:29:32 InnoDB: highest supported file format is Barracuda. 
160108 3:29:32 InnoDB: Waiting for the background threads to start 
160108 3:29:33 InnoDB: Error: tablespace size stored in header is 4224 pages, but 
160108 3:29:33 InnoDB: the sum of data file sizes is only 3840 pages 
160108 3:29:33 InnoDB: Cannot start InnoDB. The tail of the system tablespace is 
160108 3:29:33 InnoDB: missing. Have you edited innodb_data_file_path in my.cnf in an 
160108 3:29:33 InnoDB: inappropriate way, removing ibdata files from there? 
160108 3:29:33 InnoDB: You can set innodb_force_recovery=1 in my.cnf to force 
160108 3:29:33 InnoDB: a startup if you are trying to recover a badly corrupt database. 
160108 3:29:33 [ERROR] Plugin 'InnoDB' init function returned error. 
160108 3:29:33 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed. 
160108 3:29:33 [ERROR] Unknown/unsupported storage engine: InnoDB 
160108 3:29:33 [ERROR] Aborting 

160108 3:29:33 [Note] /usr/sbin/mysqld: Shutdown complete 

160108 3:29:34 [Warning] Using unique option prefix myisam-recover instead of myisam-recover-options is deprecated and will be removed in a future release. Please use the full name instead. 
160108 3:29:34 [Note] Plugin 'FEDERATED' is disabled. 
160108 3:29:34 [Warning] option 'innodb-buffer-pool-size': signed value 2097152 adjusted to 5242880 
160108 3:29:34 [Warning] option 'innodb-additional-mem-pool-size': signed value 512000 adjusted to 524288 
160108 3:29:34 InnoDB: The InnoDB memory heap is disabled 
160108 3:29:34 InnoDB: Mutexes and rw_locks use GCC atomic builtins 
160108 3:29:34 InnoDB: Compressed tables use zlib 1.2.8 
160108 3:29:34 InnoDB: Using Linux native AIO 
160108 3:29:34 InnoDB: Initializing buffer pool, size = 5.0M 
160108 3:29:34 InnoDB: Completed initialization of buffer pool 
160108 3:29:34 InnoDB: highest supported file format is Barracuda. 
160108 3:29:34 InnoDB: Waiting for the background threads to start 
160108 3:29:35 InnoDB: Error: tablespace size stored in header is 4224 pages, but 
160108 3:29:35 InnoDB: the sum of data file sizes is only 3840 pages 
160108 3:29:35 InnoDB: Cannot start InnoDB. The tail of the system tablespace is 
160108 3:29:35 InnoDB: missing. Have you edited innodb_data_file_path in my.cnf in an 
160108 3:29:35 InnoDB: inappropriate way, removing ibdata files from there? 
160108 3:29:35 InnoDB: You can set innodb_force_recovery=1 in my.cnf to force 
160108 3:29:35 InnoDB: a startup if you are trying to recover a badly corrupt database. 
160108 3:29:35 [ERROR] Plugin 'InnoDB' init function returned error. 
160108 3:29:35 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed. 
160108 3:29:35 [ERROR] Unknown/unsupported storage engine: InnoDB 
160108 3:29:35 [ERROR] Aborting 

160108 3:29:35 [Note] /usr/sbin/mysqld: Shutdown complete 
+0

而對日誌中的問題的答案? –

回答

0

innodb_force_recovery的目的是在讀的啓動MySQL只有模式和搶救用戶數據。在極少數情況下,它可以用於修復表空間(例如,刪除損壞的索引),但這只是一個例外。

當您執行轉儲時,應該停止MySQL,將現有MySQL文件移動到存檔並從轉儲中重新創建數據庫。

# service mysql stop 
# sed -i 's/innodb_force_recovery=[1-6]/innodb_force_recovery=0' /etc/my.cnf 
# mv /var/lib/mysql /var/lib/mysql.archive 
# mkdir /var/lib/mysql 
# chown -R mysql:mysql /var/lib/mysql 
# service mysql start 
# mysql < dump.sql