phpmyadmin的安装
phpmyadmin是需要根据php的版本来决定phpmyadmin的版本的。
现网中php的版本是php-5.3.18所以选择的php的版本是phpMyAdmin-4.4.0
phpmyadmin依赖的环境是:nginx-php5.3
下载地址:
https://files.phpmyadmin.net/phpMyAdmin/4.4.0/phpMyAdmin-4.4.0-all-languages.zip
安装过程:
1.解压:
unzip phpMyAdmin-4.4.0-all-languages.zip
mv phpMyAdmin-4.4.0-all-languages /var/www/phpmyadmin
2.修改nginx的配置文件:
server {
listen 8001;
index index.php index.html;
server_name _;
root /var/www/phpmyadmin;
location / {
index index.html index.htm index.php l.php;
if (!-e $request_filename) {
rewrite ^/(.*)$ /index.php/$1 last;
break;
}
}
location ~ \.php(.*)$ {
#try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass php:9000;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
}
access_log /var/log/nginx/phpmyadmin-access.log;
error_log /var/log/nginx/phpmyadmin-error.log;
}
3.修改配置文件:
cp config.sample.inc.php config.inc.php
#phpmyadmin连接数据库的地址
$cfg['Servers'][$i]['host'] = '数据库的地址';
#phpmyadmin上传sql文件存放位置
$cfg['UploadDir'] = 'import';
#phpmyadmin下载sql文件存放位置
$cfg['SaveDir'] = 'save';
4.访问:
http://ip:8001
5.配置多个数据库连接(修改config.inc.php):
1)注释配置文件:
27 //$i++;
28 /* Authentication type */
29// $cfg['Servers'][$i]['auth_type'] = 'cookie';
30 /* Server parameters */
31 //$cfg['Servers'][$i]['host'] = 'mysql';
32// $cfg['Servers'][$i]['connect_type'] = 'tcp';
33 //$cfg['Servers'][$i]['compress'] = false;
34// $cfg['Servers'][$i]['AllowNoPassword'] = false;
2).在下面添加如下内容:
数据库遍历列表//$hosts数组下标从1开始,host的值为服务器ip地址,user是对应的MySql登陆用户名,password的值为MySql的登陆密码,请修改成你自己的
//$hosts数组配置了两台服务器,如果你有多台服务器,请按数组下标递增的顺序添加配置信
$hosts = array(
‘1’=>array(‘host’=>’localhost’,’user’=>’root’,’password’=>’123456′),
‘2’=>array(‘host’=>’192.168.0.1′,’user’=>’ciray’,’password’=>’123456′)
);