【环境】Centos7配置php运行环境(Apache、mysql)

一、关闭防火墙

停止Firewall

systemctl stop firewalld.service

禁止Firewall开机启动

systemctl disable firewalld.service

查看默认防火墙的状态

firewall-cmd --state

二、安装Apache

安装

Apache# yum install httpd -y

启动

systemctl start httpd

停止

systemctl stop httpd

重启

systemctl restart httpd

开机自启

systemctl enable httpd

三、安装PHP

安装PHP

yum install php php-devel

安装PHP扩展

yum install php-mysql php-gd php-imap php-ldap
php-odbc php-pear php-xml php-xmlrpc

重启Apache

systemctl restart httpd

四、安装MySQL

安装MySQL

yum install mariadb mariadb-server -y

启动MariaDB

systemctl start mariadb 

 
停止MariaDB

systemctl stop mariadb 

 
重启MariaDB

systemctl restart mariadb

设置开机启动

systemctl enable mariadb

五、配置Mysql

 设置MySQL密码:

mysql -u root
mysql> set password for ‘root’@‘localhost’ = password('mypasswd');
mysql> exit

远程授权连接mysql

mysql> GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '123456' WITH GRANT OPTION;

配置生效

FLUSH   PRIVILEGES;
最后修改:2019 年 08 月 19 日 03 : 12 PM