Postfix with MySQL support on CentOS

Jacob Allred

I had the need to get Postfix working with MySQL support today on CentOS 5. The version of Postfix that is in the CentOS yum repo, unfortunately, doesn’t have MySQL support, and I didn’t want to compile from source.

Luckily, there is a way to get Postfix with MySQL installed using yum:

Caution: These instructions will reset your Postfix config files to the defaults. Make sure you have backups first!

First, add a few lines to your /etc/yum.repos.d/CentOS-Base.repo. The section headers should already exist, so add the additional lines immediately under the existing section header:


This tells yum to ignore the Postfix package in the normal base and update repos, and instead get it from the centosplus repo.

Next, uninstall your existing Postfix and install the new one:

yum remove postfix
yum install postfix

At this point I ran into an issue that was causing yum to refuse to install the new Postfix. I’m using the latest MySQL server RPM from, which isn’t compatible with this new version of Postfix. To fix this, I downloaded/installed the MySQL compatibility RPM that matches my version of MySQL server. This allowed Postfix to install without any problems.

Voila! You are done! You can make sure things worked by running postconf -m and verifying that mysql is listed.