一,下载phpmyadmin5:
1,官网地址:
https://www.phpmyadmin.net/
2,下载
[root@yjweb source]# wget https://files.phpmyadmin.net/phpMyAdmin/5.0.1/phpMyAdmin-5.0.1-all-languages.zip
说明:刘宏缔的架构森林是一个专注架构的博客,地址:https://www.cnblogs.com/architectforest
对应的源码可以访问这里获取: https://github.com/liuhongdi/
说明:作者:刘宏缔 邮箱: 371125307@qq.com
二,解压phpmyadmin:
1,创建存放php程序文件的目录
[root@yjweb source]# mkdir /data/web/tools [root@yjweb source]# mkdir /data/web/tools/html
2,解压,移动后目标网站所在目录
[root@yjweb source]# unzip phpMyAdmin-5.0.1-all-languages.zip [root@yjweb source]# mv phpMyAdmin-5.0.1-all-languages /data/web/tools/html/phpmyadmin
三,给nginx增加一个server文件供访问
注意:安全起见,此server不要使用对外公开的端口,
或者给此站或此服务器增加基于ip地址的限制
[root@yjweb conf.d]# vi /usr/local/openresty/nginx/conf/conf.d/tools.conf
内容:
server { listen 12345; server_name tools.demodomain.net; root /data/web/tools/html; index index.php index.html index.shtml index.htm; access_log /data/logs/nginxlogs/tools.access_log; error_log /data/logs/nginxlogs/tools.error_log; location / { try_files $uri $uri/ /index.php?$args; } location ~ .php$ { fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_buffer_size 32k; fastcgi_buffers 10240 32k; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; } }
四,重启openresty后测试访问
[root@yjweb conf.d]# systemctl stop openresty
[root@yjweb conf.d]# systemctl start openresty
地址:
http://tools.demodomain.net:12345/phpmyadmin/index.php
五,报错的处理:
mysqli::real_connect(): (HY000/2002): No such file or directory
解决:
[root@localhost soft]# cd /data/phpweb/html/phpmyadmin/ [root@localhost phpmyadmin]# cp config.sample.inc.php config.inc.php [root@localhost phpmyadmin]# vi config.inc.php
说明:
把 localhost修改为 127.0.0.1
//$cfg['Servers'][$i]['host'] = 'localhost'; $cfg['Servers'][$i]['host'] = '127.0.0.1';
六,查看本地centos的版本:
[webop@yjweb ~]$ cat /etc/redhat-release CentOS Linux release 8.0.1905 (Core)