手机
当前位置:查字典教程网 >建站 >网站运营 >在CentOS上安装phpMyAdmin的教程
在CentOS上安装phpMyAdmin的教程
摘要:这篇文章主要介绍了在CentOS上安装phpMyAdmin的教程,phpMyAdmin是一款借助PHP脚本来操作MySQL的工具,非常具有人...

这篇文章主要介绍了在CentOS上安装phpMyAdmin的教程,phpMyAdmin是一款借助PHP脚本来操作MySQL的工具,非常具有人气,需要的朋友可以参考下

前提

在CentOS上安装phpMyAdmin,你第一步需要架设一台Web服务器(如Apache或nginx),安装好MySQL/MariaDB数据库和PHP。根据你的偏好和需求,你可以从LAMP和LEMP中选择一种安装。

另一个要求是允许在你的CentOS上安装EPEL库。如果你还没设置过请猛戳这里。

在CentOS6或7上安装phpMyAdmin

一旦你设置了EPEL库,你就能轻松地用以下命令安装phpMyAdmin了。

在CentOS 7上:

?

1 $ sudo yum install phpmyadmin

在CentOS 7上:

?

1 $ sudo yum install phpmyadmin php-mcrypt

在CentOS 7上配置phpMyAdmin

默认情况下,CentOS 7上的phpMyAdmin只允许从回环地址(127.0.0.1)访问。为了能远程连接,你需要改动它的配置。

用文本编辑器打开phpMyAdmin的配置文件(路径:/etc/httpd/conf.d/phpMyAdmin.conf),找出并注释掉带有Require ip XXXX字样的代码行。会有四处这样的代码行,用Require all granted取而代之。重新改动过的配置文件如下所示。

?

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 $ sudo vi /etc/httpd/conf.d/phpMyAdmin.conf . . . . . Directory /usr/share/phpMyAdmin/ AddDefaultCharset UTF-8 IfModule mod_authz_core.c # Apache 2.4 RequireAny #Require ip 127.0.0.1 #Require ip ::1 Require all granted /RequireAny /IfModule IfModule !mod_authz_core.c # Apache 2.2 Order Deny,Allow Deny from All Allow from 127.0.0.1 Allow from ::1 /IfModule /Directory Directory /usr/share/phpMyAdmin/setup/ IfModule mod_authz_core.c # Apache 2.4 RequireAny #Require ip 127.0.0.1 #Require ip ::1 Require all granted /RequireAny /IfModule IfModule !mod_authz_core.c # Apache 2.2 Order Deny,Allow Deny from All Allow from 127.0.0.1 Allow from ::1 /IfModule /Directory . . . . .

最后,重启httpd使改动生效。

?

1 $ sudo systemctl restart httpd

在CentOS 6上配置phpMyAdmin

默认情况下,CentOS 6上的phpMyAdmin是禁止从每个IP地址访问的。为了能远程连接,你需要改动它的配置。

用文本编辑器打开phpMyAdmin的配置文件(路径:/etc/httpd/conf.d/phpMyAdmin.conf),找出并注释掉Deny from all字样的代码行。然后把Allow from 127.0.0.1字样的代码行改成Allow from 0.0.0.0。重新改动过的配置文件如下所示。

?

1 2 3 4 5 6 7 $ sudo vi /etc/httpd/conf.d/phpmyadmin.conf Directory /usr/share/phpmyadmin Order Deny,Allow # Deny from all Allow from 0.0.0.0 /Directory

下一步是将phpMyAdmin的配置文件用blowfish加密工具加密。这一步需要加密cookie里的密码来作为基于cookie的部分认证。

用文本编辑器打开如下路径所示的文件并且用blowfish设置一个随机密码,如下所示。

?

1 2 3 $ sudo vi /usr/share/phpmyadmin/config.inc.php $cfg['blowfish_secret'] = 'kd5G}d33aXDc50!'; /* YOU MUST FILL IN THIS FOR COOKIE AUTH! */

最后,重启httpd使改动生效。

?

1 $ sudo service httpd restart

测试phpMyAdmin

测试phpMyAdmin是否设置成功,访问这个页面:/phpmyadmin

在CentOS上安装phpMyAdmin的教程1

【在CentOS上安装phpMyAdmin的教程】相关文章:

分析事件营销的20个核心技巧

一毛钱的成本,从0爆增50000+粉丝的

如何选择主机和域名商

微信运营最重要的方面有哪些

微信运营和微博运营的50条经验分享

在EuroDns上注册域名的简明教程

在DaoCloud的Docker容器中搭建WordPress及绑定域名的教程

如何使关键词排名稳定在百度首页

2016年如何做好个人博客? 2016做好个人博客的三个要素

在DreamHost共享主机上新增站点与设定GoDaddy DNS的方法

精品推荐
分类导航