1.检查当前安装的PHP包
yum list installed | grep php 或者 yum list installed php*
如果要删除,可执行
yum remove php.x86_64 php-cli.x86_64
2.rpm包
CentOs 6.x
rpm -Uvh http://mirror.webtatic.com/yum/el6/latest.rpm
CentOs 7.X
rpm -Uvh https://mirror.webtatic.com/yum/el7/epel-release.rpm
rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
如果想删除上面安装的包,重新安装
rpm -qa | grep webtatic
rpm -e 上面搜索到的包即可
3.查看可安装的php版本
yum list php*
4.安装
这里我选择了php5.6来安装
yum -y install php56w
(实际上这里安装完php的时候,apache2.2也安装上了)
安装扩展
yum install php56w-mysql
yum install php56w-gd
yum install php56w-mbstring
重启apache
service httpd restart
============================================
安装apache2.4
执行
cd /etc/yum.repos.d
wget http://repos.fedorapeople.org/repos/jkaluza/httpd24/epel-httpd24.repo
wget http://www.hop5.in/yum/el6/hop5.repo
建议先把已安装的卸载掉(上面已有apache2.2)
查看已安装
yum list installed httpd*
卸载
yum remove httpd
查看可安装httpd
yum list httpd*
安装
yum install httpd24-httpd httpd24-httpd-devel httpd24-mod_ssl hhvm
=========================================
安装mysql5.7.15
yum方式安装(推荐)
http://dev.mysql.com/downloads/repo/yum/
以centos6.x为例
rpm -Uvh http://dev.mysql.com/get/mysql57-community-release-el6-9.noarch.rpm
搜索
yum list mysql*
现在可以看到mysql5.7
yum install mysql-community-server
------------------------------------------------------------分割线---------------------------
rpm方式安装
查看并卸载自带的mysql
先用rpm -qa | grep -i mysql 指令查看,然后用rpm -e --nodeps 卸载对应的组件
官方下载
http://dev.mysql.com/downloads/mysql/
cd /
wget http://cdn.mysql.com//Downloads/MySQL-5.7/mysql-community-common-5.7.15-1.el6.x86_64.rpm
wget http://cdn.mysql.com//Downloads/MySQL-5.7/mysql-community-libs-5.7.15-1.el6.x86_64.rpm
wget http://cdn.mysql.com//Downloads/MySQL-5.7/mysql-community-client-5.7.15-1.el6.x86_64.rpm
wget http://cdn.mysql.com//Downloads/MySQL-5.7/mysql-community-server-5.7.15-1.el6.x86_64.rpm
下载以上文件到到 /目录
先安装依赖(mysql5.7需要)
yum -y install numactl
yum -y install perl
依次执行安装
rpm -ivh mysql-community-common-5.7.15-1.el6.x86_64.rpm
rpm -ivh mysql-community-libs-5.7.15-1.el6.x86_64.rpm
rpm -ivh mysql-community-client-5.7.15-1.el6.x86_64.rpm
rpm -ivh mysql-community-server-5.7.15-1.el6.x86_64.rpm
启动
service mysqld start
开机自动启动
chkconfig mysqld on
获得MySQL初始密码
grep ‘temporary password‘ /var/log/mysqld.log
这里的 >gjpjgkb:0cX 就是root的默认密码
登录mysql
mysql -uroot -p‘密码‘
即 mysql -uroot -p
mysql5.7的安全机制加强,要求立即修改密码,否则无法继续操作
修改新密码
ALTER USER ‘root‘@‘localhost‘ IDENTIFIED BY ‘新密码‘;
注意密码要足够复杂(8位,大写字母,小写字母,数字,特殊符号),否则修改失败
允许远程登录
Grant all privileges on *.* to ‘root‘@‘%‘ identified by ‘HAOabc2016!‘ with grant option;
flush privileges;
-----------------------------------------------------------------------------------------------------------------------
如何解决ERROR 1819 (HY000): Your password does not satisfy the current policy requirements
呢?
必须修改两个全局参数:
首先,修改validate_password_policy参数的值
mysql> set global validate_password_policy=0;
再修改密码的长度
set global validate_password_length=1;
-----------------------------------------------------------------------------------------------------------------------
MySQL的默认安装位置
/etc/my.cnf
#配置文件
/var/lib/mysql/
#数据库目录
/usr/share/mysql
#配置文件目录
/usr/bin
#相关命令目录
/etc/init.d/mysql
#启动脚本
本文引用:http://blog.csdn.net/buyueliuying/article/details/52535724
原文地址:https://www.cnblogs.com/tonnytong/p/8203448.html