Even for DBAs already familiar with MySQL, the choice of installation methods and the variety of install/package files is overwhelming and confusing.
I’ll make a (very!) brief introduction to the various installation options, concentrating on the Linux operating system, and provide with a simple shopping list.
For illustration, I’ll refer to the MySQL 5.1.52 community edition, the latest at the time of this writing. Downloads are available at http://dev.mysql.com/downloads/mysql/5.1.html.
I will then refer to alternate distributions.
A note for Windows users
You are lucky: your choice is very clear. Download the Windows MSI package. Choose 32 or 64 bit architecture according to your OS. If you know about the other ways to install and setup MySQL under Windows, you don’t need this post.
Linux: repositories
Easiest way to install MySQL on linux would be to use your distro’s repository. Just:
sudo apt-get install mysql-server-5.1
or
sudo yum install MySQL-Server-5.1
Your distro should resolve any package dependencies.
I’m in the opinion that if MySQL is the main application to be used on a server, distribution’s default repositories are not the way to go. Reasons include MySQL outdated version, incapability of installing multiple instance, danger of automatic upgrades or downgrades. Read this post and discussion that follows for more.
Linux: packages
If you’re a RedHat/CentOS/SuSE user, you’re in luck: MySQL provides pre-built RPM packages for your system. I vaguely remember MySQL announcing that Ubuntu is to be supported. That was a couple years ago; there is still no package for Debian/Ubuntu.
So, assuming you’re a RedHat/CentOs user, which packages should you download?
There’s over 60 different RPMs available for download. I always need to stress my eyes to get it right. Here’s the simple answer (again, if you know better, you don’t need this post). Choose “RedHat & Oracle Enterprise Linux”; download:
- MySQL-client-community-5.1.52-1.rhel5.x86_64.rpm
- MySQL-server-community-5.1.52-1.rhel5.x86_64.rpm
- MySQL-shared-community-5.1.52-1.rhel5.x86_64.rpm
- MySQL-shared-compat-5.1.52-1.rhel5.x86_64.rpm
The above assumes a RedHat/CentOS 5.x and a 64 bit Intel/AMD processor.
The aforementioned post relays my opinion of using RPMs; these are still susceptible to yum‘s whims. Be careful.
Linux: binary
Not afraid to install by hand? Want to avoid limitations introduced by pre-built packages? Download a binary distribution:
- Choose “Linux – Generic”. Downlaod mysql-5.1.52-linux-x86_64-glibc23.tar.gz
This tar.gz distribution includes server & client. It includes glibc so it does not depend on your OS installed glibc version (a pain to upgrade/downgrade as it is used by so many packages).
You may still want to download and install the shared-compat RPM package (see previous section) to have all possible libmysqlclientX.X packages installed.
Linux: source
If you got here, then you either know your way around (why do you keep reading?) or you have a good reason to use a source distribution.
What good reason could that be?
A more and more common reason is that you want to add something to MySQL. Sphinx search storage engine is such a common addition.
- Choose “Source Code”: download mysql-5.1.52.tar.gz (Architecture Independent).
Non MySQL downloads
You don’t have to download the official MySQL distribution. Two good alternatives are:
- Percona Server; download from http://www.percona.com/software/percona-server/. The Percona Server (a MySQL fork by Percona) is available in RPM, DEB, BSD, Binary, Source distributions. There are no Windows distributions.
- MariaDB, download from http://askmonty.org/wiki/MariaDB:Download. MariaDB is a MySQL fork by Montry Program AB, and is available for Windows, Linux, Solaris, in Source, Binary, RPM and DEB distributions.