Many persons prefer to install MySQL from the binaries compiled with Mysql, rather than using packages (rpm, apt, ...):
- Installing the packages in directories of your choice, it quite difficult
- It depends on the frequency of updating those packages: Unable to test a new version
- Sometimes you want to install multiple versions and switch easily from one to another but when an update is available and that you install it how can I go, how will you revert the changes in case of problems
The alternatives are:
compiling the source code, is sometimes complicated and the result could reveal to be less performant that using the orignal source code of Mysql ...
use binaries compiled by Mysql ( the topic that we shall discuss below).
Note that this manipulation will take less than 15 minutes, and gives you a fresh installation of Mysql
Note: The following steps can make a clean install, if you want to migrate, just skip the setup steps, setting up data files, ...
- Installation will be in/usr/ local
- You have sufficient rights on the server
- The Unix user will be "Mysql" (existing account)
Retrieve binary mysql
- 1) Retrieve binary mysql: here we take an Intel 64bit Linux server
> Wget http://mirrors.ircam.fr/pub/mysql/Downloads/MySQL-5.1/mysql-5.1.39-linux-x86_64-glibc
Creating symlink mysql
- 3) Creating symlink mysql: it suffices to repeat this step for change at a version update (upgrade) for example.
Implementation of the configuration file
- 5)Implementation of the configuration file in /etc/my.cnf: Many examples are provided with the binaries, just pick one. Here, we take the "mysql-huge" which is suitable for machines with 4GB RAM
- 6)Your Configuration: Edit the file the: /etc/my.cnf, and decide at least the directory that contains your data (datadir): By default, it is > /usr/local/mysql/data/
user = mysql
basedir = /usr/local/mysql
datadir = /mon/repertoire/mysql
- 7) Set up the init.d script that will stop/relaunch Mysql (start, stop, restart, ...)
- 8) Set the minimum data:
This will create the directory, install the system tables, ...
- 9)Start mysql:
- 10)Best Practice: immediately assign the root user password! (it is empty by default)
- 11)Tools like (mysql client, mysqldump, ...) are located in the directory /usr/local/mysql/bin :: to be able to call from anywhere, you can either add this directory to your PATH (file ~/.bashrc)
create symlinks in /usr/bin/
- Finally, if you are migrating from 5.0 to Mysql 5.1, the script bin/mysql-upgrade will allow you to update the system tables (INFORMATION_SCHEMA, ...)