CentOS7+apache+php7+mysql5.7 Configuration tutorial details

  • 2020-06-15 10:57:58
  • OfStack


 yum upgrade
yum install net-tools

Install apache

Close the SELinux

The editor opens the etc/selinux/config file, finds the SELINUX=enforcing field, changes it to SELINUX=disabled, and restarts the device.


yum -y install httpd mod_ssl

Configure the firewall


firewall-cmd --permanent --add-port=80/tcp
firewall-cmd --permanent --add-port=443/tcp
firewall-cmd --reload

Powered up


systemctl start httpd
systemctl enable httpd

The terminal input the following instructions to check the running status of httpd


sudo systemctl status httpd

Install PHP7

Add the source


rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm

The installation


yum install php70w

Install mysql5. 7

1. Install wget


  yum -y install wget

2. Install the source


 wget http://dev.mysql.com/get/mysql57-community-release-el7-8.noarch.rpm
  rpm -ivh mysql57-community-release-el7-8.noarch.rpm

3. Install mysql


  yum install mysql-server

Start the mysql service


yum -y install httpd mod_ssl
0

5. Check the startup status of MySQL


yum -y install httpd mod_ssl
1

6. Boot up


yum -y install httpd mod_ssl
2

7. Change the root local login password

Find the random password generated by mysql


 grep 'temporary password' /var/log/mysqld.log
  mysql -uroot -p

Note: es69EN5.7 is installed as the default password security check plug-in (validate_password). The default password check policy requires that the password must contain: upper and lower case letters, Numbers, and special symbols, and must be no less than 8 bits long. Otherwise, ERROR 1819 (HY000): Your password does not satisfy current policy requirements error


yum -y install httpd mod_ssl
4

8. Configure the default encoding as utf8

Modify the /etc/ my.cnf profile to add the encoding configuration under [mysqld]


yum -y install httpd mod_ssl
5

9. Configure mysql remote connection


yum -y install httpd mod_ssl
6

Then use the following command to see which users and host are accessible, with % representing any ip address


yum -y install httpd mod_ssl
7

Firewall adds port 3306


firewall-cmd --zone=public --add-port=3306/tcp --permanent
firewall-cmd --reload

mysql forgot your password

1. Modify the configuration file of MySQL (default: /etc/ my.cnf) and add 1 line skip-ES118en-ES119en under [mysqld]

After service mysqld restart, you can enter with mysql directly

3.


yum -y install httpd mod_ssl
9

Restore /etc/ my.cnf file and restart mysql:service mysql restart. At this time, you can use ES139en-ES140en ES141en-ES143en 'to enter

mysql > SET PASSWORD = PASSWORD (' newpasswd '); Set a new password

conclusion


Related articles: