Is it possible to install iRedMail on server with existing MySQL database?

What will happen when I will install iRedMail, will it delete my all my databases or just skip MySQL installation and use existing server instance?

1 Answer 1


Normally it will keep your databases. From the iRedmail website:

How to Use Exist MySQL Server
If you already have MySQL server running in your local net, you can use it to store virtual domains and users.

Configure iRedMail as above, but when it ask 'Contine? [Y|n]', choose no to continue:
Configuration completed.

**************************** WARNNING ***********************************
*                                                                       *
* Please do remember to *REMOVE* configuration file after installation  *
* completed successfully.                                               *
*                                                                       *
*   * /root/iRedMail-x.y.z/config   # <- config file location
*                                                                       *

<<< iRedMail >>> Continue? [Y|n]   # <-- Type 'n' or 'N' here to exit installation
<<< iRedMail >>> Canceled, Exit.
Edit 'iRedMail-x.y.z/conf/mysql', find these variables:
export MYSQL_SERVER=''
export MYSQL_PORT='3306'
export MYSQL_SOCKET='/var/lib/mysql/mysql.sock'
export MYSQL_ROOT_USER='root'
export MYSQL_ROOT_PASSWD='passwd'
Use your exist MySQL server info here:
export MYSQL_FRESH_INSTALLATION='NO'    # <- Set to 'NO' so that iRedMail won't install mysql-server.
export MYSQL_SERVER=''   # <- MySQL server address.
export MYSQL_PORT='3306'                # <- MySQL server port.
export MYSQL_SOCKET='/var/lib/mysql/mysql.sock'
export MYSQL_ROOT_USER='root'           # <- MySQL root user, iRedMail will use it to import some databases.
export MYSQL_ROOT_PASSWD='secret'       # <- MySQL root user's password.
If your Apache and PHP are not installed in standard directory, you should edit 'conf/httpd' to change them:
# HTTPD_SERVERROOT: Apache server root, default is
#   - /var/www (RHEL/CentOS)
#   - /usr/share/apache2 (Debian)
# HTTPD_DOCUMENTROOT: Document root, default is
#   - /var/www/html (RHEL/CentOS)
#   - /var/www/default-site (Debian)
export HTTPD_SERVERROOT='/var/www'
export HTTPD_CONF="/etc/httpd/conf/httpd.conf"
export HTTPD_CONF_DIR="/etc/httpd/conf.d"
export PHP_MODULES_DIR="${HTTPD_SERVERROOT}/lib/php/modules/"
export HTTPD_SSL_CONF="${HTTPD_CONF_DIR}/ssl.conf"

# ---- PHP ----
export PHP_INI='/etc/php.ini'
If you already have all Apache+PHP+MySQL related binary packages installed, you must tell iRedMail not to install them in conf/global:
If you just want iRedMail not to install MySQL related binary packages, you must edit 'functions/packages.sh', remove mysql related packages. Such as php-mysql, mysql-server, mysql, mysql-client, etc.
OK, re-execute the main script:
# bash iRedMail.sh
<<< iRedMail >>> Check configuration file: /root/iRedMail-x.y.z/config... Found.
<<< Question >>> Use it for mail server setting? [y|N]y             # <- Type 'y' or 'Y' here
<<< iRedMail >>> Use configuration file: /root/iRedMail-x.y.z/config for mail server setting.
How to use mbox format
Although maildir is recommended (more popular, better performance) and default mailbox format, but iRedMail also support mbox format.

Modify 'iRedMail-x.y.z/conf/global', change 'HOME_MAILBOX' to 'mbox' before you start iRedMail installation:

# Maildir format: mbox, Maildir.
Start iRedMail installation now.
  • Exactly what I was looking for, many thanks Lucas!
    – Matthias
    Oct 14, 2012 at 11:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.