云胡编程精选集我爱编程

Linux服务器搭建apache,php,mysql

2017-08-26  本文已影响0人  云胡同学

Apache
查看httpd包是否可用

yum list | grep httpd

安装apache

yum install httpd

apache扩展

yum -y install httpd-manual mod_ssl mod_perl mod_auth_mysql

启动

systemctl start httpd.service

停止

systemctl stop httpd.service

重启

systemctl restart httpd.service

查看状态

service httpd status

设置开机自动启动:

chkconfig httpd on

安装目录介绍 Apache默认将网站的根目录指向/var/www/html 目录
默认的主配置文件是/etc/httpd/conf/httpd.conf
配置存储在的/etc/httpd/conf.d/目录
php安装

yum install -y php

php扩展

yum install php-mysql php-gd libjpeg* php-imap php-ldap php-odbc php-pear php-xml php-xmlrpc php-mbstring php-mcrypt php-bcmath php-mhash libmcrypt libmcrypt-devel php-fpm

运行php文件,显示源码,所以 要让Apache支持php。

mysql安装

yum install mysql

yum install mysql-devel

wget http://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm

rpm -ivh mysql-community-release-el7-5.noarch.rpm

yum install mysql-community-server

mysql扩展

yum -y install mysql-connector-odbc mysql-devel libdbi-dbd-mysql

启动

systemctl start mysqld.service

停止

systemctl stop mysqld.service

重启

systemctl restart mysqld.service

设置新密码

set password for 'root'@'localhost' =password('新密码');

刷新权限

FLUSH PRIVILEGES;

远程连接设置

grant all privileges on . to root@'%'identified by 'password';

任何ip都可以通过root账号远程连接。

上一篇下一篇

猜你喜欢

热点阅读