首先去官网下载 phpMyAdmin
phpMyAdmin - Files https://www.phpmyadmin.net/files/
因为 phpMyAdmin 的界面是完全基于您的浏览器,所以您需要一个网站服务器(如 Apache, nginx, IIS)来安装 phpMyAdmin。
Which PHP versions does phpMyAdmin support?
Since release 4.5, phpMyAdmin supports only PHP 5.5 and newer. Since release 4.1 phpMyAdmin supports only PHP 5.3 and newer. For PHP 5.2 you can use 4.0.x releases.
PHP 7 is supported since phpMyAdmin 4.6, PHP 7.1 is supported since 4.6.5, PHP 7.2 is supported since 4.7.4.
HHVM is supported up to phpMyAdmin 4.8.
Since release 5.0, phpMyAdmin supports only PHP 7.1 and newer.
这里由于我装的是 PHP Version 5.4.16,所以准备安装 4.4 的版本。
然后访问 http://YOUE-IP/phpMyAdmin 试试。
这是报错找不到文件夹,解决办法就是创建该文件夹 /var/lib/php/session
然后刷新页面,继续报错
代码语言:javascript复制Warning in ./libraries/session.inc.php#105
session_start(): open(/var/lib/php/session/sess_htpikat322t7fgvok2nh4sb4tkcrla55, O_RDWR) failed: Permission denied (13)
这里赋予 “其他” 写的权限即可。
然后访问 http://YOUR-IP/phpMyAdmin/setup。配置一下后下载生成最终的 config.inc.php 文件
代码语言:javascript复制<?php
/*
* Generated configuration file
* Generated by: phpMyAdmin 4.4.15.10 setup script
* Date: Sun, 13 Sep 2020 12:00:57 0000
*/
/* Servers configuration */
$i = 0;
/* Server: localhost [1] */
$i ;
$cfg['Servers'][$i]['verbose'] = '';
$cfg['Servers'][$i]['host'] = '127.0.0.1';
$cfg['Servers'][$i]['port'] = '';
$cfg['Servers'][$i]['socket'] = '';
$cfg['Servers'][$i]['connect_type'] = 'tcp';
$cfg['Servers'][$i]['auth_type'] = 'cookie';
$cfg['Servers'][$i]['user'] = 'root';
$cfg['Servers'][$i]['password'] = '';
/* End of servers configuration */
$cfg['blowfish_secret'] = '<sE>9W,96Ml)&3j@ahb-V|=y!uqwC,Qy';
$cfg['DefaultLang'] = 'zh_CN';
$cfg['ServerDefault'] = 1;
$cfg['UploadDir'] = '';
$cfg['SaveDir'] = '';
?>
这里注意我将 host 改为了 127.0.0.1, 因为不知为何我设置为localhost一直连接不上服务器。 connect_type tcp 然后认证方式 cookie user 我这里设置为数据库管理员的密码 root
blowfish_secret 为自动生成32位长度,我直接拿来用就行。
设置完毕后保存,现在可以上传到 nginx 上指定目录。
浏览http://网站域名/phpmyadmin/测试一下。(输入数据库的用户名及密码就可以了)