Oracle comes with a set of binary distributions of MySQL. This includes generic binary distributions in the form of compressed tar files (files that have a .tar.xz extension) for many platforms, and binaries in platform-specific package formats for specific platforms.
MySQL compressed tar file binary distributions have names in the format ‘mysql−VERSION−OS.tar.xz’, where VERSION refers to a number and OS indicates the type of operating system on which the distribution is required to be used.
To install a compressed tar file binary distribution, the installation needs to be unpacked into a location that is chosen by user. Debug versions of the mysqld binary are available as mysqld−debug.
If the user’s own debug version needs to be used to compile MySQL from a source distribution, appropriate configuration options need to be used.
To install and use a MySQL binary distribution, the below shown command sequence needs to be used −
shell> groupadd mysql shell> useradd −r −g mysql −s /bin/false mysql shell> cd /usr/local shell> tar xvf /path/to/mysql−VERSION−OS.tar.xz shell> ln −s full−path−to−mysql−VERSION−OS mysql shell> cd mysql shell> mkdir mysql−files shell> chown mysql:mysql mysql−files shell> chmod 750 mysql−files shell> bin/mysqld −−initialize −−user=mysql shell> bin/mysql_ssl_rsa_setup shell> bin/mysqld_safe −−user=mysql & # Below command is optional shell> cp support−files/mysql.server /etc/init.d/mysql.server
The above assumes that the user has root (administrator) access to their system.
The mysql-files directory provides an easy location to use as the value for the secure_file_priv system variable. This limits the import and export operations to a specific directory only. See Section 5.1.8, “Server System Variables”.
The steps are briefed as shown below −
Create a mysql User and Group. It can be done using below commands −
shell> groupadd mysql shell> useradd −r −g mysql −s /bin/false mysql
Obtain and unpack the distribution. It can be done using below commands −
shell> cd /usr/local
Unpack the distribution, that will create the installation directory. The ‘tar’ can uncompress and unpack the distribution if it has ’z’ option support. It can be done using below commands −
shell> tar xvf /path/to/mysql−VERSION−OS.tar.xz
The tar command creates a directory named mysql−VERSION−OS
The tar command can be replaced with below command to uncompress and extract the distribution −
shell> xz −dc /path/to/mysql−VERSION−OS.tar.xz | tar x
A symbolic link can be created to the installation directory that has been created by tar −
shell> ln −s full−path−to−mysql−VERSION−OS mysql
The ‘ln’ command creates a symbolic link to the installation directory. This enables the user to refer more easily to the poth as /usr/local/mysql. The /usr/local/mysql/bin directory can be added to the user’s PATH variable using the below commad −
shell> export PATH=$PATH:/usr/local/mysql/bin