腾讯云CentOS7.2 配置PHP7 MySQL

本文介绍如何在CentOS7.2上配置PHP7与MySQL服务器,包括删除旧版PHP、安装PHP7及设置相应的YUM源,以及安装和启动MySQL服务。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

腾讯云CentOS7.2 配置PHP7 MySQL

服务器系统 :CentOS7.2

查看系统版本:

cat /etc/centos-release     //CentOS Linux release 7.2.1511 (Core) 
  • 1

删除之前的 php 版本:

yum remove php* php-common
  • 1

rpm 安装 Php7 相应的 yum源

CentOS/RHEL 7.x:

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
  • 1
  • 2

CentOS/RHEL 6.x:

rpm -Uvh https://mirror.webtatic.com/yum/el6/latest.rpm
  • 1

直接yum安装php7:

yum install php70w  
  • 1

重启服务:

systemctl restart httpd.service
  • 1

下为systemctl指令:

systemctl enable *.service #开机运行服务
systemctl disable *.service #取消开机运行
systemctl start *.service #启动服务
systemctl stop *.service #停止服务
systemctl restart *.service #重启服务
systemctl reload *.service #重新加载服务配置文件
systemctl status *.service #查询服务运行状态
systemctl --failed #显示启动失败的服务
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8

安装MySQL:

下载mysql的repo源:

wget http://repo.mysql.com/mysql-community-release-el7-5.noarch.rpm
  • 1

安装mysql-community-release-el7-5.noarch.rpm包:

sudo rpm -ivh mysql-community-release-el7-5.noarch.rpm
  • 1

安装mysql:

sudo yum install mysql-server
  • 1

开启MySQL:

systemctl start mysql
  • 1

重置密码:

/bin/mysqladmin -u root -p password 
//Enter password : 为空 
//New password: 新密码
//Confirm new password: 新密码
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值