A few words of thanks would be greatly appreciated.

Installation/Migration - Mysql 5.1 with the official binaries

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, ...

Assume that:

  • 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

Cd/usr/local /
> Wget http://mirrors.ircam.fr/pub/mysql/Downloads/MySQL-5.1/mysql-5.1.39-linux-x86_64-glibc


  • 2)Decompression:
    •  tar zxvf /usr/local/mysql-5.1.39-linux-x86_64-glibc23.tar.gz
    • This creates the directory
    • > /usr/local/mysql-5.1.39-linux-x86_64-glibc2 
  • 3) Creating symlink mysql: it suffices to repeat this step for change at a version update (upgrade) for example.
    • ln -s mysql-5.1.39-linux-x86_64-glibc23/ mysql

Rights Assignment:

  • 4)Rights Assignment:
    • Cd / usr / local / mysql  

Chown-R mysql. Chgrp-R mysql.

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
    • cp support-files/my-huge.cnf /etc/my.cnf


  • 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/
    • [mysqld] 

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, ...)
    • > cp support-files/mysql.server /etc/init.d/mysql
    • Then as a precaution to edit this file to the correct datadir (datadir =...)
  • 8) Set the minimum data:
    • > ./scripts/mysql_install_db --datadir=(same as above) --user=mysql

This will create the directory, install the system tables, ...

Getting started

  • 9)Start mysql:
    • > /etc/init.d/mysql start
  • 10)Best Practice: immediately assign the root user password! (it is empty by default)
    • > ./bin/mysqladmin -u root password "password"
    • The INSTALL-BINARY explains you all this, with variations, but the goal is the same ...
  • 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, ...)

A few words of thanks would be greatly appreciated.

Ask a question
CCM is a leading international tech website. Our content is written in collaboration with IT experts, under the direction of Jean-François Pillou, founder of CCM.net. CCM reaches more than 50 million unique visitors per month and is available in 11 languages.
This document, titled « Installation/Migration - Mysql 5.1 with the official binaries », is available under the Creative Commons license. Any copy, reuse, or modification of the content should be sufficiently credited to CCM (ccm.net).