King0770-Notes-Drop-Single-Mboxgroup-and-Reimport
- This article is a Work in Progress, and may be unfinished or missing sections.
There are times when there is a single mboxgroup DB that is corrupted, and you don't need to dump the DB's for every mboxgroup.
Here's an example of dumping mboxgroup9.
First, you may need to find out which accounts are on mboxgroup9.
mysql -e "select comment, group_id from zimbra.mailbox where group_id='9'"
1) zmcontrol stop
2) Edit the file /opt/zimbra/conf/my.cnf and add a line innodb_force_recovery = 1 under the [mysqld] section
(Note that it may be necessary to increase the recovery level depending on the extent of the database corruption, as shown at the end of the database dump step)
3) mysql.server start
4) source ~/bin/zmshutil
5) zmsetvars
6) mkdir /tmp/mysql.sql
7) ~/mysql/bin/mysqldump mboxgroup9 -S $mysql_socket -u root --password=$mysql_root_password >> /tmp/mysql.sql/mboxgroup9.sql
8) mysql -u root --password=$mysql_root_password -e "drop database mboxgroup9"
9) mysql -e "create database mboxgroup9 character set utf8"
10) mysql.server stop
11) Comment line in my.cnf ( innodb_force_recovery = 1)
12) mysql.server start
13) mysql mboxgroup9 < /tmp/mysql.sql/mboxgroup9.sql
14) mysql.server stop
15) zmcontrol start
See the following article to do a complete mysql export and import for the whole server:
http://wiki.zimbra.com/index.php?title=Mysql_Crash_Recovery