Let us understand how to install MySQL from a source distribution −
Building MySQL from source
You need the following tools to build and install MySQL from source −
GNU needs to be installed so as to uncompress the distribution. Another ‘tar’ should be installed to unpack the distribution.
ANSI C++ compiler.
A good ‘make’ program. GNU make is recommended
The below commands need to be executed to install a MySQL source distribution from an unpacked ‘tar’ file −
shell> configure shell> make shell> make install shell> scripts/mysql_install_db shell> /usr/local/mysql/bin/safe_mysqld &
If you start from a source RPM, then do the following.
shell> rpm −−rebuild MySQL−VERSION.src.rpm
This will ‘make’ a binary RPM that can be installed by the user.
New users can be added using the bin/mysql_setpermission script if DBI and Msql−MySQL−modules Perl modules are installed.
Let us understand the steps in detail −
To install source distribution, pick a directory where the distribution needs to be unpackged and move there.
The distribution file has to be obtained from one of the sites listed in ‘Getting MySQL’. MySQL source distributions are given as compressed tar archives.
The distribution needs to be unpacked into the current directory using the below command −
shell> gunzip < mysql−VERSION.tar.gz | tar xvf −
This would create a directory named `mysql−VERSION'.
The user has to change into top−level directory of the unpacked distribution using the below command −
shell> cd mysql-VERSION
The release has to be configured, and then compiled, using the below commands −
shell> ./configure −−prefix=/usr/local/mysql shell> make
When ‘configure’ is run, certain options can be specified. Install everything using the below command, and ensure that it is run as root −
shell> make install
MySQL grant tables need to be created if MySQL is being installed for the first time −
shell> scripts/mysql_install_db
Once this is done, initialize and test the distribution to ensure everything works fine.