MySQL Backup and Restore zimbra

Generate SQL dumps of all databases


socket         = /opt/zimbra/data/tmp/mysql/mysql.sock

su - zimbra
zmlocalconfig -s | grep mysql | grep password

The output will look something like this.
mysql_logger_root_password = AWHZ60JYaBw8_hVkA9NDVGh0irmp7xVz
mysql_root_password = lkAd7vkYI.Q_VeWt8uyL9kj0
zimbra_logger_mysql_password = 2iiyAVj3GeH0akkCe6M1o_HvY
zimbra_mysql_password = uMv4EsNqPZdK5htERx97VY5m

mysql --batch --skip-column-names -e "show databases" | grep -e mbox -e zimbra > /tmp/mysql.db.list

Note: If you are using ZCS v8.8.x with Chat/Talk enabled then you should take Chat database dump as well
mysql --batch --skip-column-names -e "show databases" | grep -e mbox -e zimbra -e chat > /tmp/mysql.db.list

mkdir /tmp/mysql.sql 

for db in `cat /tmp/mysql.db.list`; do
 /opt/zimbra/common/bin/mysqldump $db -S /opt/zimbra/data/tmp/mysql/mysql.sock -u root –password=PLC61rw56DsvvM0hMIZbvhTvY4 > /tmp/mysql.sql/$db.sql
     echo “Dumped $db”
     sleep 10


Leave a Comment

Your email address will not be published. Required fields are marked *

Open chat