MySQL has a dependency on the libaio library. The data directory initialization, and subsequent server startup steps, will fail if this library is not installed locally.
On YUM-based systems:
shell> sudo yum install -y libaio
On APT-based systems:
shell> sudo apt-get install -y libaio1
Download the TAR binary from the MySQL Downloads page, at https://dev.mysql.com/downloads/mysql/, then choose Linux - Generic as the OS and select the version. You can download directly onto your server directly using the wget command:
shell> cd /opt
shell> wget "https://dev.mysql.com/get/Downloads/MySQL-8.0/mysql-8.0.3-rc-linux-glibc2.12-x86_64.tar.gz"
Install MySQL using the following steps:
- Add the mysql group and the mysql user. All the files and directories should be under the mysql user:
shell> sudo groupadd mysql
shell> sudo useradd -r -g mysql -s /bin/false mysql
- This is the installation location (you can change it to another location):
shell> cd /usr/local
- Untar the binary file. Keep the untarred binary file at the same location and symlink it to the installation location. In this way, you can keep multiple versions and it is very easy to upgrade. For example, you can download another version and untar it to a different location; while upgrading, all you need to do is to change the symlink:
shell> sudo tar zxvf /opt/mysql-8.0.3-rc-linux-glibc2.12-x86_64.tar.gz
mysql-8.0.3-rc-linux-glibc2.12-x86_64/bin/myisam_ftdump
mysql-8.0.3-rc-linux-glibc2.12-x86_64/bin/myisamchk
mysql-8.0.3-rc-linux-glibc2.12-x86_64/bin/myisamlog
mysql-8.0.3-rc-linux-glibc2.12-x86_64/bin/myisampack
mysql-8.0.3-rc-linux-glibc2.12-x86_64/bin/mysql
~
- Make the symlink:
shell> sudo ln -s mysql-8.0.3-rc-linux-glibc2.12-x86_64 mysql
- Create the necessary directories and change the ownership to mysql:
shell> cd mysql
shell> sudo mkdir mysql-files
shell> sudo chmod 750 mysql-files
shell> sudo chown -R mysql .
shell> sudo chgrp -R mysql .
- Initialize mysql, which generates a temporary password:
shell> sudo bin/mysqld --initialize --user=mysql
~
2017-12-02T05:55:10.822139Z 5 [Note] A temporary password is generated for root@localhost: Aw=ee.rf(6Ua
~
- Set up the RSA for SSL. Refer to Chapter 14, Setting up Encrypted Connections using X509 Section, for more details on SSL. Note that a temporary password is generated for root@localhost: eJQdj8C*qVMq:
shell> sudo bin/mysql_ssl_rsa_setup
Generating a 2048 bit RSA private key
...........+++
....................................+++
writing new private key to 'ca-key.pem'
-----
Generating a 2048 bit RSA private key
...........................................................+++
...........................................+++
writing new private key to 'server-key.pem'
-----
Generating a 2048 bit RSA private key
.....+++
..........................+++
writing new private key to 'client-key.pem'
-----
- Change the ownership of binaries to root and data files to mysql:
shell> sudo chown -R root .
shell> sudo chown -R mysql data mysql-files
- Copy the startup script to init.d:
shell> sudo cp support-files/mysql.server /etc/init.d/mysql
- Export the binary of mysql to the PATH environment variable:
shell> export PATH=$PATH:/usr/local/mysql/bin
- Refer to Starting or Stopping MySQL 8 section to start MySQL.
After installation, you will get the following directories inside /usr/local/mysql:
Directory
|
Contents of directory
|
bin
|
mysqld server, client, and utility programs
|
data
|
Log files, databases
|
docs
|
MySQL manual in info format
|
man
|
Unix manual pages
|
include
|
Include (header) files
|
lib
|
Libraries
|
share
|
Miscellaneous support files, including error messages, sample configuration files, SQL for database installation
|