1

Topic: moving database to another sql server?

==== Required information ====
- iRedMail version (check /etc/iredmail-release): 0.9.7
- Linux/BSD distribution name and version: debian 9.1
- Store mail accounts in which backend (LDAP/MySQL/PGSQL): mysql
- Web server (Apache or Nginx): nginx
- Manage mail accounts with iRedAdmin-Pro? no
- [IMPORTANT] Related original log or error message is required if you're experiencing an issue.
====

Hi,
I want to move my sql databases, which are currently on the local iredmail server, to a database server in the same network.

Is there any documentation which configs to edit, so everthing will work fine?

----

Spider Email Archiver: On-Premises, lightweight email archiving software developed by iRedMail team. Supports Amazon S3 compatible storage and custom branding.

2

Re: moving database to another sql server?

We don't have document yet. The procedure is:

*) Export databases on iRedMail first, then import them on your remote mysql server.
*) Make sure SQL users used by iRedMail have required privileges to query remote SQL server.
*) Make sure SQL service is accessible in firewall.
*) Update postfix/dovecot/roundcube/... config files to use remote SQL server address.

3

Re: moving database to another sql server?

ZhangHuangbin wrote:

We don't have document yet. The procedure is:

*) Export databases on iRedMail first, then import them on your remote mysql server.
*) Make sure SQL users used by iRedMail have required privileges to query remote SQL server.
*) Make sure SQL service is accessible in firewall.
*) Update postfix/dovecot/roundcube/... config files to use remote SQL server address.

Followup question:
Which files is subject to change in this case?

4

Re: moving database to another sql server?

/etc/postfix/mysql/*
/etc/dovecot/dovecot-mysql.conf
/opt/www/roundcubemail/config/config.inc.php
...

5

Re: moving database to another sql server?

Howdy, Ive been using iRedmail for some years, its a great product !

Ha Ha, this reply is 4 years late but even if it helps just one person save some pain and time. Here are the files Ive need to edit when moving an MySQL DB for iRedmail, Ive done it a few times successfully.  Keep in mind I simply "moved" the SQL db location, so the IP and port had changed - in this case mySql is hosted in a Kubernetes (container) cloud infrastructure.

On the iRedmail host(s) I used the following commands to find instances of my current (known) MysQL IP then use a tool like sed to quickly change to the new IP (and port if required)  - after file edit restart dovecot and postfix.

Keep in mind this is not a complete SQL migration plan,  just simply how to change the IP and port. All iRedmail stack services sql passwords remained the same in my case as mySQL hosting was simply "moved"

grep <your_mysql_ip_addr> /etc/postfix/mysql/*
grep <your_mysql_ip_addr> /etc/dovecot/dovecot-mysql.conf
grep <your_mysql_ip_addr> /etc/dovecot/dovecot-share-folder.conf
grep <your_mysql_ip_addr> /etc/dovecot/dovecot-used-quota.conf
grep <your_mysql_ip_addr> /opt/www/roundcubemail/config/config.inc.php
grep <your_mysql_ip_addr> /opt/www/iredadmin/settings.py
grep <your_mysql_ip_addr> /etc/amavis/conf.d/50-user
grep <your_mysql_ip_addr> /root/.my.cnf
grep <your_mysql_ip_addr> /root/.my.cnf-amavisd
grep <your_mysql_ip_addr> /root/.my.cnf-iredadmin
grep <your_mysql_ip_addr> /root/.my.cnf-roundcube
grep <your_mysql_ip_addr> /root/.my.cnf-vmail
grep <your_mysql_ip_addr> /root/.my.cnf-vmailadmin
grep <your_mysql_ip_addr> /opt/mlmmjadmin/settings.py

then change the IP to the new mySQL location.

6

Re: moving database to another sql server?

Hi @peterc, thanks for sharing. smile