This section covers installation prerequisites, creating the
mysql user and group, and unpacking the
The installation must be performed as an operating system
rootuser, as the installation process involves creating a user, a group, directories, and assigning ownership and permissions. Installed MySQL binaries are owned by the operating system
Unless otherwise indicated, procedures in this guide are performed as the operating system
MySQL has a dependency on the
libaiolibrary. Data directory initialization and subsequent server startup steps fail if this library is not installed locally. If necessary, install it using the appropriate package manager. For example, on Yum-based systems:
shell> yum search libaio # search for info shell> yum install libaio # install library
mysql user owns the MySQL data directory.
It is also used to run the
process, as defined in the systemd
mysqld.service file (see
Starting the Server using systemd). The
mysql user has read and write access to
anything in the MySQL data directory. It does not have the
ability to log into MySQL. It only exists for ownership
mysql group is the database administrator
group. Users in this group have read and write access to
anything in the MySQL data directory, and execute access on any
packaged MySQL binary.
This command adds the
shell> groupadd -g 27 -o -r mysql
-g 27 and
options assign a non-unique group ID (GID). The
-r option makes the group a system group.
This command adds the
shell> useradd -M -N -g mysql -o -r -d datadir -s /bin/false -c "MySQL Server" -u 27 mysql
-Moption prevents the creation of a user home directory.
-Noption indicates that the user should be added to the group specified by the
-u 27options assign a non-unique user ID (UID).
-s /bin/falseoptions create a user without login permissions to the server host. The
mysqluser is required only for ownership purposes, not login purposes.
-doption specifies the user login directory, which is set to the expected MySQL data directory path. The expected data directory path in this deployment is
-coption specifies a comment describing the account.
To extract the binary files from the verified MySQL Linux Generic Binary download package:
Change location to the directory under which you want to unpack the MySQL distribution. In this deployment, the distribution is unpackaged by
shell> cd /usr/local
Unpack the MySQL distribution, which creates the installation directory. Any modern tar program can uncompress and unpack the distribution with this command:
shell> tar xvf /path/to/mysql-commercial-8.0.xx-linux-glibc2.12-x86_64.tar.gz
The tar command creates a directory named
mysql-. In this case, the directory is named
xxis the latest release.
Create a relative symbolic link to the installation directory created by tar:
shell> cd /usr/local shell> ln -s mysql-commercial-8.0.xx-linux-glibc2.12-x86_64 mysql
lncommand makes a symbolic link to the installation directory. This enables you to refer more easily to it as
To avoid typing the path name of client programs when working
with MySQL, add the
directory to your
shell> export PATH=/usr/local/mysql/bin:$PATH
Unpacking the distribution creates the directories shown in the
following table. The directories are located in the MySQL
installation directory, which is
Table 4.1 MySQL Linux Generic Binary Distribution Directories
|Directory||Contents of Directory|
|mysqld server; client and utility programs|
|MySQL manual in Info format|
|Unix manual pages|
|Include (header) files|
|Miscellaneous files, including error messages, sample configuration files, SQL for database installation|
|Miscellaneous support files related to managing multiple server processes, automatic startup configuration, and log rotation.|
Also included in the MySQL installation directory are the
files. There is no data directory. It is created later when the
data directory is initialized.