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;

你可能感兴趣的:(linux)