Before You Begin
-
Ensure that you have followed the Getting Started and Securing Your Server guides, and the Linode’s hostname is set.
To check your hostname run:
hostname hostname -f
The first command should show your short hostname, and the second should show your fully qualified domain name (FQDN).
-
Update your system:
sudo yum update
-
You will need
wget
to complete this guide. It can be installed as follows:yum install wget
Install MySQL
MySQL must be installed from the community repository.
-
Download and add the repository, then update.
wget http://repo.mysql.com/mysql-community-release-el7-5.noarch.rpm sudo rpm -ivh mysql-community-release-el7-5.noarch.rpm yum update
-
Install MySQL as usual and start the service. During installation, you will be asked if you want to accept the results from the .rpm file’s GPG verification. If no error or mismatch occurs, enter
y
.sudo yum install mysql-server sudo systemctl start mysqld
MySQL will bind to localhost (127.0.0.1) by default.
Harden MySQL Server
-
Run the
mysql_secure_installation
script to address several security concerns in a default MySQL installation.sudo mysql_secure_installation
You will be given the choice to change the MySQL root password, remove anonymous user accounts, disable root logins outside of localhost, and remove test databases. It is recommended that you answer yes
to these options. You can read more about the script in the MySQL Reference Manual.