查看: 1531|回復: 3

[教學] 如何mysqldump plesk 10.4資料庫

發表於 2012-2-14 13:12:26 | 顯示全部樓層 |閱讀模式
Push to Facebook Push to Plurk Push to Twitter 
解決方法To resolve the problem, it is recommended that you recover the InnoDB engine. However, note that the recovery may fail. In this case, it is recommended to restore databases from backup. To recover an InnoDB engine, it's recommended to dump all databases, remove the databases and corrupted InnoDB files, recreate a base mysql engine, and restore the databases from dump.

Use the following instructions to conduct recovery:

1) Stop mysqld and backup all database files located in /var/lib/mysql/:

~# /etc/init.d/mysqld stop
~# mkdir /root/mysql_backup
~# cp -r /var/lib/mysql/* /root/mysql_backup/

2) Add option innodb_force_recovery into section [mysqld] of MySQL configuration file. This option will allow you to start mysql and create a database dump. For example, in /etc/my.cnf:

innodb_force_recovery = 4

NOTE: You may increase the option from 1 to 2, 3 to 6, until you receive a proper dump. Please see details here.

3) Start the mysqld service:

# /etc/init.d/mysqld start

4) Make a dump of all the databases, e.g.:


# mysqldump -uadmin -p`cat /etc/psa/.psa.shadow` -A > dump.sql

cat /etc/psa/.psa.shadow


If dumping failed with an error (for example "Incorrect information in file: './psa/APSApplicationItems.frm' when using LOCK TABLES"), try increasing innodb_force_recovery and try to dump the databases anew.

5) Now recreate the main database "mysql" and the InnoDB engine. To do so, stop mysqld:

~# /etc/init.d/mysqld stop

6) Remove the contents of /var/lib/mysql/. (Make sure you have all actual dumps or a recent copy of the directory backed up in section 1):

~# rm -rf /var/lib/mysql/*

7) Remove the option innodb_force_recovery in /etc/my.cnf.

8) Start mysqld:

~# /etc/init.d/mysqld start

This will recreate a main MySQL database "mysql" and InnoDB engine database. You may see that database files have been created in /var/lib/mysql/. However, note that only a default MySQL configuration was recreated. All custom databases should be restored from the dump.

9) Restore the databases from the dump:

~# mysql -uadmin -p`cat /etc/psa/.psa.shadow` < dump.sql


發表於 2013-11-9 01:09:35 | 顯示全部樓層


發表於 2013-11-9 01:09:35 | 顯示全部樓層

您需要登錄後才可以回帖 登錄 | 註冊 |



GMT+8, 2016-10-24 23:11 , Processed in 0.057996 second(s), 18 queries .

本論壇言論純屬發表者個人意見,與 TShopping綜合論壇 立場無關 如有意見侵犯了您的權益 請寫信聯絡我們。

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

快速回復 返回頂部 返回列表