赞
踩
1.检查当前安装的PHP包
yum list installed | grep php
如果要删除,可执行
yum remove php.x86_64 php-cli.x86_64 php-common.x86_64 php-gd.x86_64 php-ldap.x86_64 php-mbstring.x86_64 php-mcrypt.x86_64 php-mysql.x86_64 php-pdo.x86_64
2.rpm包
CentOs 5.x
rpm -Uvh http://mirror.webtatic.com/yum/el5/latest.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.x86_64
(实际上这里安装完php的时候,apache2.2也安装上了)
安装php-mysql扩展
yum install php56w-mysql
安装mbstring扩展
yum install php56w-mbstring
编辑php.ini文件
vi /etc/php.ini
加入一行
extension=mbstring.so //经测试,可以不加这行
重启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'>gjpjgkb:0cX'
mysql5.7的安全机制加强,要求立即修改密码,否则无法继续操作
修改新密码
ALTER USER 'root'@'localhost' IDENTIFIED BY '新密码';
注意密码要足够复杂(8位,大写字母,小写字母,数字,特殊符号),否则修改失败
允许远程登录
Grant all privileges on *.* to 'root'@'%' identified by 'HAOabc2016!' with grant option;
flush privileges;
MySQL的默认安装位置
/etc/my.cnf
#配置文件
/var/lib/mysql/
#数据库目录
/usr/share/mysql
#配置文件目录
/usr/bin
#相关命令目录
/etc/init.d/mysql
#启动脚本
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。