1.下载
http://www.phpmyadmin.net/
进入之后有download按钮,点击导航栏的Download链接,进入下载界面,这里下载最新版的 phpMyAdmin 4.9.2
2.下载下来上传到服务器上,然后执行下面命令解压:
tar -xvzf phpMyAdmin-4.9.2-all-languages.tar.gz
3.移动到网站可访问地址(网站根目录)下
mv phpMyAdmin-4.9.2-all-languages /var/www/
4.重命名文件夹(phpMyAdmin-4.9.2-all-languages)为 phpmyadmin
5.这时候可以看到目录下有一个配置文件:config.sample.inc.php,将这个文件拷贝一份成config.inc.php
cp config.sample.inc.php config.inc.php
然后执行编辑:
vim config.inc.php
找到$cfg['blowfish_secret']配置项,后面默认为空,这里我们可以随便设置一个复杂的字符串,用来加密使用;
然后$cfg['Servers'][$i]['auth_type']这一项默认为cookie,表示每次都要登录,我们不用修改,这样比较安全;
然后$cfg['Servers'][$i]['host'] = '127.0.0.1';这里修改成自己数据库链接地址
$cfg['blowfish_secret'] = '随便设置一个复杂的字符串'; /* YOU MUST FILL IN THIS FOR COOKIE AUTH! */ /** * Servers configuration */ $i = 0; /** * First server */ $i++; /* Authentication type */ $cfg['Servers'][$i]['auth_type'] = 'cookie'; /* Server parameters */ $cfg['Servers'][$i]['host'] = '数据库host地址'; $cfg['Servers'][$i]['connect_type'] = 'tcp'; $cfg['Servers'][$i]['compress'] = false; $cfg['Servers'][$i]['AllowNoPassword'] = false;
如下:
6.配置nginx
server { client_max_body_size 20M; listen 80; server_name 47.**.**.230; set $root_path '/var/www/phpmyadmin'; root $root_path; index index.php index.html index.htm; try_files $uri $uri/ @rewrite; location ~ .php { fastcgi_pass 127.0.0.1:9000; fastcgi_index /index.php; fastcgi_split_path_info ^(.+.php)(/.+)$; fastcgi_param PATH_INFO $fastcgi_path_info; fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; } }
重启nginx
service nginx restart
7.访问