CentOs安装配置phpMyAdmin其实非常简单,所谓的安装其实是不存在的,因为phpMyAdmin是php写的嘛,所以只需要下载安装包然后解压之后,简单配置下就可以使用了,下面给他家说下如何正确配置phpMyAdmin
安装:
1、首先在phpMyAdmin官方网站 http://www.phpmyadmin.net/downloads
下载源码包,或者通过ZaLou.Cn进行下载://www.zalou.cn/codes/405261.html
,下载后上传到服务器解压即可,或者通过Linux命令来下载安装(推荐)
2、下载phpMyAdmin安装包
wget https://files.phpmyadmin.net/phpMyAdmin/5.2.1/phpMyAdmin-5.2.1-all-languages.zip
3、解压文件
unzip phpMyAdmin-5.2.1-all-languages.zip
4、将 phpMyAdmin-5.2.1-all-languages 放到web目录下 并重新命名
mv phpMyAdmin-5.2.1-all-languages /usr/local/nginx/html/phpMyAdmin
5、重新命名
配置:
cd /usr/local/nginx/html/phpMyAdmin/libraries
vim config.default.php
### 修改以下3处地方
$cfg['Servers'][$i]['host'] = '127.0.0.1';
$cfg['Servers'][$i]['user'] = 'root';
$cfg['Servers'][$i]['password'] = '123456';
mysqli_real_connect(): (HY000/2002): No such file or directorymysqli_real_connect(): (HY000/2002): No such file or directory
解决方法:
把phpmyadmin目录中的配置文件config.sample.inc.php
改成config.inc.php
。并且修改以下:
$cfg['Servers'][$i]['host'] = 'localhost';
#改成
$cfg['Servers'][$i]['host'] = '127.0.0.1';
再次刷新页面就不会出现mysqli_real_connect(): (HY000/2002): No such file or directory
的错误提示了。
访问:
本项目在放在 nginx 测试目录html下,在浏览器中输入 ip:/phpMyAdmin,然后输入用户名、密码即可。
补充下 phpmyadmin
的 nginx
配置 :
server {
listen 80;
server_name xxxxx.mysql.com;
root /usr/local/nginx/html/phpMyAdmin;
access_log /opt/weblog/$server_name.access.log main;
if ($http_user_agent ~ "DNSPod") {
return 200;
}
try_files $uri $uri/ @rewrite;
location @rewrite {
rewrite ^/(.*)$ /index.php?_url=/$1;
}
location ~ \.php {
fastcgi_pass 127.0.0.1:9000;
client_max_body_size 64m;
fastcgi_index index.php;
fastcgi_split_path_info ^(.+\.php)(.*)$;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
location / {
index index.php index.html index.htm;
}
}