Centos安装Apache+PHP+Mysql

2020年4月9日 · 11 views · 

安装Apache

yum install httpd

配置Apache

启用.htaccess

编辑/etc/httpd/conf/httpd.comf,找到<Directory "网站根目录">的标签,把里面的AllowOverrideNone改成All

安装Mysql 5.7

wget -i -c http://dev.mysql.com/get/mysql57-community-release-el7-10.noarch.rpm
yum -y install mysql57-community-release-el7-10.noarch.rpm
yum -y install mysql-community-server

配置Mysql

查看默认密码

打开/var/log/mysqld.log,定位到“A temporary password is generated for root@localhost”,记下密码

登录Mysql

mysql -u root -p

进入用户数据库

use mysql

修改root默认密码

alter user 'root'@'localhost' identified by 'Password';

允许root远程访问

grant all privileges on *.* to root@"%" identified by 'Password';; 

添加用户(此处为system)

create user system identified by 'Password';

添加用户访问数据库权限

grant select, insert, update, delete on *.* to 'system'@'localhost' identified by 'Password';

安装php5.6

卸载原有版本

yum remove php-common

安装php

yum install epel-release
rpm -ivh http://rpms.famillecollet.com/enterprise/remi-release-7.rpm
yum install --enablerepo=remi --enablerepo=remi-php56 php php-mysql
 |  | 
返回

Steven's Website Copyright © 2020 Steven
Powerd by Wordpress & Theme by Steven
粤ICP备20028373号