方法一:
yum安装使用Nginx,mariadb,php搭建phpMyAdmin:centos7 - nginx配置安装phpmyadmin - 让双脚&去腾空 - 博客园 (cnblogs.com)
方法二:
step1:源码编译安装nginx
依赖包:gcc openssl-devel pcre-devel zlib-devel readline-devel
step2:安装php,php-fpm,配置php支持mysql模块
操作见上两章
step3:下载phpMyAdmin.zip解压到nginx的网页根目录下面
修改nginx配置:
location /phpMyAdmin { root /usr/share/nginx/html; #yum安装的nginx默认的网页根路径。
#拼接/usr/share/nginx/html/phpMyAdmin
index index.php;
}
location ~ .php$ {
root /usr/share/nginx/html;
fastcgi_pass 127.0.0.1:9000; #nginx找到网页转发给本机的9000端口执行解释
fastcgi_index index.php;
#fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
include fastcgi.conf;
}
修改phpMyAdmin配置:
cp config.sample.inc.php config.inc.php
vim config.inc.php
$cfg['blowfish_secret'] = '+_qhx$yw,{/j0<:[<wP.n5nWRZGO9^B<'; //随便写,不要写太短
$cfg['Servers'][$i]['host'] = '192.168.1.48'; //指定mysql数据库的地址
$cfg['Servers'][$i]['pmadb'] = 'phpmyadmin';
$cfg['Servers'][$i]['bookmarktable'] = 'pma__bookmark';
$cfg['Servers'][$i]['relation'] = 'pma__relation';
$cfg['Servers'][$i]['table_info'] = 'pma__table_info';
$cfg['Servers'][$i]['table_coords'] = 'pma__table_coords';
$cfg['Servers'][$i]['pdf_pages'] = 'pma__pdf_pages';
$cfg['Servers'][$i]['column_info'] = 'pma__column_info';
$cfg['Servers'][$i]['history'] = 'pma__history';
$cfg['Servers'][$i]['table_uiprefs'] = 'pma__table_uiprefs';
$cfg['Servers'][$i]['tracking'] = 'pma__tracking';
$cfg['Servers'][$i]['userconfig'] = 'pma__userconfig';
$cfg['Servers'][$i]['recent'] = 'pma__recent';
$cfg['Servers'][$i]['favorite'] = 'pma__favorite';
$cfg['Servers'][$i]['users'] = 'pma__users';
$cfg['Servers'][$i]['usergroups'] = 'pma__usergroups';
$cfg['Servers'][$i]['navigationhiding'] = 'pma__navigationhiding';
$cfg['Servers'][$i]['savedsearches'] = 'pma__savedsearches';
$cfg['Servers'][$i]['central_columns'] = 'pma__central_columns';
$cfg['Servers'][$i]['designer_settings'] = 'pma__designer_settings';
$cfg['Servers'][$i]['export_templates'] = 'pma__export_templates'; //解开注释即可
step4:重启php。nginx
pkill php-fpm
php-fpm
./nginx -s stop
./nginx
./nginx -s reload
访问测试:http://ip/phpMyAdmin 数据库用户、密码
问题:
找到phpMyAdmin中的create_tables.sql文件,并导入
重启数据库服务后,发现还是提示“phpmyadmin显示高级功能尚未完全设置部分功能未激活”,点链接进去后,发现如下图的提示(root权限问题)
出现这个的原因是 phpmyadmin的安装目录, tmp目录不存在,或者存在但是权限不对。解决的方法就是没有创建一下这个目录,给予正确的读写权限即可。
cd phpmyadmin
mkdir tmp
chmod 777 tmp