CentOS 6.x LAMP配置 mysql5.7.7+php5.6

浏览:592 发布日期:2019/04/05 分类:求助交流 关键字: LAMP配置
到http://dev.mysql.com/downploads/repo/yum/下载centos6.x的rpm文件,我们选择:

Red Hat Enterprise Linux 6 / Oracle Linux 6 (Architecture Independent), RPM Package



直接wget下载到/var目录:

1.
2.
1.
# cd /var/# wget http://repo.mysql.com/mysql-community-release-el6-5.noarch.rpm
下载后我们在/var/下会发现mysql-community-release-el6-5.noarch.rpm这个文件;



安装RPM文件

1.
1.
# sudo yum localinstall mysql-community-release-el6-5.noarch.rpm


查看RPM文件是否安装成功:

1.
1.
# yum repolist all| grep "mysql.*-community.*"
如果安装好会出现:

1.
2.
3.
4.
5.
6.
1.
mysql55-community MySQL 5.5 Community Server disabledmysql55-community-source MySQL 5.5 Community Server - So disabledmysql56-community MySQL 5.6 Community Server enabledmysql56-community-source MySQL 5.6 Community Server - So disabledmysql57-community-dmr MySQL 5.7 Community Server Deve disabled mysql57-community-dmr-source MySQL 5.7 Community Server Deve disabled
禁用老版本的mysql,并启用mysql5.7

1.
2.
1.
# sudo yum-config-manager --disable mysql56-community# sudo yum-config-manager --enable mysql57-community-dmr
查看是否启用成功:

1.
1.
# yum repolist enabled | grep mysql

安装mysql:

1.
1.
# sudo yum install mysql-community-server
下载中...(那天等了好久哟,不知是不是自己人品不行),这里要回答几个Yes;

安装好后,开启一下mysql:

1.
1.
# sudo service mysqld start
提示:

1.
1.
Starting mysqld: [ OK ]
设置mysql开机启动:

1.
1.
# chkconfig --levels 235 mysqld on
先关闭mysql:

1.
1.
# sudo service mysqld stop
设置mysql密码:(这里比较难懂,mysql5.7.7默认给你设置了一个初始密码,但又不告诉你,所以只能做忘记root密码处理了)

1.
1.
# mysqld_safe --skip-grant-tables & mysql -u root -p
会提示输入密码,这里直接回车



更新一下mysql权限:

1.
1.
mysql> FLUSH PRIVILEGES; (这里是mysql的语句FLUSH PRIVILEGES;)
修改密码:

1.
1.
mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'MyNewPass'; (MyNewPass就是你的新密码)
最后退出mysql:

1.
1.
mysql> \q;
重启mysql:

1.
1.
# sudo service mysql restart
密码修改完毕,尝试用新密码登录:

1.
1.
# mysql -u root -p
提示输入密码,输入你刚修改的密码就行了;



二.安装并配置Apache
安装apache:

1.
1.
# yum -y install httpd
设置apache开机启动:

1.
1.
# chkconfig --levels 235 httpd on
开启apache:

1.
1.
# service httpd start
测试:现在直接在浏览器键入

https://www.thinkcmf.com/user/index/index/id/10604.html

https://www.thinkcmf.com/user/index/index/id/10607.html

https://www.thinkcmf.com/user/index/index/id/10608.html

https://www.thinkcmf.com/user/index/index/id/10609.html

https://www.thinkcmf.com/user/index/index/id/10610.html

https://www.thinkcmf.com/user/index/index/id/10611.html

https://www.thinkcmf.com/user/index/index/id/10612.html

https://www.thinkcmf.com/user/index/index/id/10613.html

https://www.thinkcmf.com/user/index/index/id/10614.html

https://www.thinkcmf.com/user/index/index/id/10615.html

https://www.thinkcmf.com/user/index/index/id/10616.html

https://www.thinkcmf.com/user/index/index/id/10617.html

https://www.thinkcmf.com/user/index/index/id/10618.html

https://www.thinkcmf.com/user/index/index/id/10619.html

https://www.thinkcmf.com/user/index/index/id/10621.html

https://www.thinkcmf.com/user/index/index/id/10620.html

https://www.thinkcmf.com/user/index/index/id/10622.html

https://www.thinkcmf.com/user/index/index/id/10623.html

https://www.thinkcmf.com/user/index/index/id/10624.html

三.安装并配置PHP5.6
添加php5.6的源

1.
1.
# rpm -Uvh http://mirror.webtatic.com/yum/el6/latest.rpm
安装php模块:(这里列出的都是一些常用的,如果不需要可以选择性安装)

1.
1.
yum install php56w php56w-common php56w-gd php56w-imap php56w-intl php56w-ldap php56w-mbstring php56w-mcrypt php56w-mssql php56w-mysqlnd php56w-odbc php56w-pdo php56w-pgsql php56w-snmp php56w-soap php56w-tidy php56w-xml php56w-xmlrpc php56w-opcache php56w-pecl-memcache

这里有关于php5.6模块的详细说明,https://webtatic.com/packages/php56/



重启apache:

1.
1.
# service httpd restart
四.安装并配置phpMyAdmin
下载一个phpmyadmin的安装包,放到可以访问到的目录就可以了



注:winscp是一个很不错的linux资源管理工具,很类似ftp客户端;
最佳答案
评论() 相关
后面还有条评论,点击查看>>