Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to configure the CentOS7+apache+php7+mysql5.7 environment

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly introduces how to configure the CentOS7+apache+php7+mysql5.7 environment, has a certain reference value, interested friends can refer to, I hope you can learn a lot after reading this article, the following let the editor take you to understand it.

Yum upgradeyum install net-tools

Install apache

Close 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/tcpfirewall-cmd-permanent-add-port=443/tcpfirewall-cmd-reload

Boot up

Systemctl start httpdsystemctl enable httpd

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

Sudo systemctl status httpd

Install PHP7

Add sourc

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

Installation

Yum install php70w

Install mysql5.7

1. Install wget

Yum-y install wget

two。 Installation 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

4. Start the mysql service

Systemctl start mysqld

5. Check the startup status of MySQL

Systemctl status mysqld

6. Boot up

Systemctl enable mysqld systemctl daemon-reload

7. Modify root local login password

Find random passwords generated by mysql

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

Change the password, note: mysql5.7 installed password security check plug-in (validate_password) by default, the default password check policy requires that the password must contain: uppercase and lowercase letters, numbers and special symbols, and the length must not be less than 8 digits. Otherwise, it will prompt ERROR 1819 (HY000): Your password does not satisfy the current policy requirements error

ALTER USER 'root'@'localhost' IDENTIFIED BY' MyNewPass4passport'

8. Configure the default encoding as utf8

Modify / etc/my.cnf configuration file and add encoding configuration under [mysqld]

[mysqld] character_set_server=utf8 init_connect='SET NAMES utf8'

9. Configure mysql remote connection

Mysql-uroot-p use mysql; Grant all on *. * to 'root'@'%' identified by' root user's password 'with grant option;flush privileges

Then use the following command to see which users and host can access,% represents any ip address

Select user,host from user

Add port 3306 to the firewall

Firewall-cmd-zone=public-add-port=3306/tcp-permanentfirewall-cmd-reload

10.mysql forgot his password

1. Modify the configuration file of MySQL (default is / etc/my.cnf) and add a line skip-grant-tables under [mysqld]

After 2.service mysqld restart, you can directly use mysql to enter

3.

Mysql > update mysql.user set authentication_string=password ('123qwe') where user='root' and Host =' localhost'; mysql > flush privileges; mysql > quit

Restore the / etc/my.cnf file, restart mysql:service mysql restart, and then use mysql-u root-pendant 123qwe' to enter.

Mysql > SET PASSWORD = PASSWORD ('newpasswd'); set new password

Thank you for reading this article carefully. I hope the article "how to configure CentOS7+apache+php7+mysql5.7 Environment" shared by the editor will be helpful to everyone. At the same time, I also hope you will support us and pay attention to the industry information channel. More related knowledge is waiting for you to learn!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report