田野 2015-09-07
环境说明:
系统版本:CentOS 6.6 32bit
软件版本:mysql 5.6.25 、nginx1.6.2 、 php5.4.37 LNMP架构
说明:mysql5.5版本以上需要使用phpmyadmin4.4版本以上;
步骤如下:
# unzip phpMyAdmin-4.4.7-all-languages.zip
# mv phpMyAdmin-4.4.7-all-languages/* /usr/local/nginx/html/phpmyadmin/
# cd /usr/local/nginx/html/phpmyadmin/
# cp config.sample.inc.php config.inc.php
浏览器访问 192.168.20.5/phpmyadmin
使用root用户,密码为mysql密码登录;
报错如下图:无法登录MySQL服务器;
出现这个错误,表示没有连接到数据库
解决方法:
# vi config.inc.php
找到这一行 $cfg['Servers'][$i]['host'] = 'localhost';
修改为:$cfg['Servers'][$i]['host'] = '127.0.0.1';
重新连接就登录进去了;
nginx虚拟主机配置如下:
# cat /usr/local/nginx/conf/vhosts/default.conf
server
{
listen 80;
server_name 192.168.20.5;
index index.html index.htm index.php;
root /usr/local/nginx/html;
location ~ \.php$ {
include fastcgi_params;
fastcgi_pass unix:/tmp/php-fcgi.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
}
php-fpm配置如下:
# cat /usr/local/php/etc/php-fpm.conf
[global]
pid = /usr/local/php/var/run/php-fpm.pid
error_log = /usr/local/php/var/log/php-fpm.log
[www]
user = php-fpm
group = php-fpm
listen = /tmp/php-fcgi.sock
listen.mode = 0666
pm = dynamic
pm.max_children = 50
pm.start_servers = 20
pm.min_spare_servers = 5
pm.max_spare_servers = 35
pm.max_requests = 500
rlimit_files = 1024
phpMyAdmin 的详细介绍:请点这里
phpMyAdmin 的下载地址:请点这里