Basic Server Setup
1 2 3 |
# update system sudo yum install epel-release -y sudo yum update -y |
1 2 |
# temporary switches off SELinux enforcing sudo setenforce 0 |
1 2 3 4 5 6 7 8 9 |
# setup timezone sudo rm /etc/localtime sudo ln -s /usr/share/zoneinfo/Hongkong /etc/localtime # setup ntp service sudo yum -y install ntp sudo ntpdate pool.ntp.org sudo systemctl enable ntpd sudo systemctl start ntpd |
Setup MySQL 5.7
1 2 3 4 5 6 7 |
# adding the MySQL Yum Repository sudo rpm -Uvh http://dev.mysql.com/get/mysql57-community-release-el7-9.noarch.rpm # setup mysql server sudo yum install mysql-server -y sudo systemctl enable mysqld sudo systemctl start mysqld |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
# get temporary root password sudo cat /var/log/mysqld.log | grep "temporary password" # 2016-10-22T06:14:44.222048Z 1 [Note] A temporary password is # generated for root@localhost: [TEMPORARY ROOT PASSWORD] # config mysql server mysql_secure_installation # Securing the MySQL server deployment. # Enter password for user root: [TEMPORARY ROOT PASSWORD] # The existing password for the user account root has expired. Please set a new password. # New password: [NEW PASSWORD] # Re-enter new password: [NEW PASSWORD] # Change the password for root ? : N # Remove anonymous users? : Y # Disallow root login remotely? : Y # Remove test database and access to it? : Y # Reload privilege tables now? : Y |
Setup Firewall (Optional)
1 2 3 4 5 |
# setup firewall sudo yum install firewalld -y sudo systemctl enable firewalld sudo systemctl start firewalld sudo firewall-cmd --add-service=mysql --permanent |
Reboot after Setup
1 |
reboot |
Optional Settings for MySQL 5.7
Disable MySQL Strict Mode
1 2 3 4 |
# disable MySQL strict mode vi /etc/my.cnf sql-mode= sudo systemctl restart mysqld |
Reference: https://dev.mysql.com/doc/refman/5.7/en/sql-mode.html
Fix MySQL Password Expired
To establish a global policy such that passwords never expire.
Update /etc/my.cnf
1 2 |
[mysqld] default_password_lifetime=0 |
Reference: https://dev.mysql.com/doc/refman/5.7/en/password-expiration-policy.html