這篇文章主要介紹了CentOS7+apache+php7+mysql5.7配置教學詳解,需要的朋友可以參考下
yum upgrade yum install net-tools
##安裝apache
關閉SELinux
編輯器開啟etc/selinux/config 文件,找到SELINUX=enforcing 字段,改為SELINUX=disabled ,並重新啟動裝置。
yum -y install httpd mod_ssl
設定防火牆
#firewall-cmd --permanent --add-port=80/tcp
firewall-cmd --permanent --add-port=443/tcp
firewall-cmd --reload
開機啟動
systemctl start httpd systemctl enable httpd
終端機輸入下列指令檢查httpd的運作狀態
sudo systemctl status httpd
安裝PHP7
##新增來源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
#
yum install php70w
1.安裝wget
yum -y install wget
2.安裝來源
wget http://dev.mysql.com/get/mysql57-community-release-el7-8.noarch.rpm rpm -ivh mysql57-community-release-el7-8.noarch.rpm
3.安裝mysql
yum install mysql-server
systemctl start mysqld
systemctl status mysqld
systemctl enable mysqld systemctl daemon-reload
grep 'temporary password' /var/log/mysqld.log mysql -uroot -p
## 修改密碼,注意:mysql5.7預設安裝了密碼安全檢查外掛(validate_password),預設密碼檢查策略要求密碼必須包含:大小寫字母、數字和特殊符號,長度不能少於8位。否則會提示ERROR 1819 (HY000): Your password does not satisfy the current policy requirements錯誤
ALTER USER 'root'@'localhost' IDENTIFIED BY 'MyNewPass4!';
##
[mysqld] character_set_server=utf8 init_connect='SET NAMES utf8'
##
mysql -uroot -p use mysql; Grant all on *.* to 'root'@'%' identified by 'root用户的密码' with grant option; flush privileges;
## 修改/etc/my.cnf設定文件,在[mysqld]下新增編碼設定
select user,host from user;
#9.設定mysql遠端連線
firewall-cmd --zone=public --add-port=3306/tcp --permanent firewall-cmd --reload
mysql> update mysql.user set authentication_string=password('123qwe') where user='root' and Host = 'localhost'; mysql> flush privileges; mysql> quit;
以上是php7和apache與CentOS7和mysql5.7的設定教學詳解的詳細內容。更多資訊請關注PHP中文網其他相關文章!