VM-16+CtenOS-8+Linux-8+LANMP环境中安装phpMyAdmin &快速使用-完整版

文章目录

  • VM-16+CtenOS-8+Linux-8+LANMP环境中安装phpMyAdmin &快速使用-完整版
  • @[toc]
    • ==【教程大纲】==
    • P-00) 运行环境配置
    • P-01) 源码编译安装 `Nginx` 的方法
    • P-02) 源码编译安装 `Apache` 的方法
    • P-03) 源码编译安装 `MySQL` 的方法
    • P-04) 源码编译安装 `PHP` 的方法
    • P-05) phpMyAdmin下载
    • P-06) 以【Nginx*】运行为例
    • P-07) 【phpMyAdmin】中【Cookie】解密设置

【教程大纲】

P-00) 运行环境配置

  • 运行平台: VM虚拟实验室
  • 操作系统: CtenOS-8_x86_64
  • 终端系统: Linux-8_x86_64
  • Web服务: Apache-2.4.48 & Nginx-1.20.1
  • MySQL服务: MySQL-8.0.25-1.el8.x86_64
  • PHP服务: PHP-8.0.9

P-01) 源码编译安装 Nginx 的方法

  • 源码编译安装【Ninux】的方法请参阅……

P-02) 源码编译安装 Apache 的方法

  • 源码编译安装【Apache】的方法请参阅……

P-03) 源码编译安装 MySQL 的方法

  • 源码编译安装【MySQL】的方法请参阅……

P-04) 源码编译安装 PHP 的方法

  • 源码编译安装【PHP】

P-05) phpMyAdmin下载

  • 【phpMyAdmin】ftp 下载地址&方式:

  • 将【phpMyAdmin】压缩包用ftp 上传至 nginx 站点根目录:

P-06) 以【Nginx*】运行为例

  • 进到 nginx 站点根目录:
cd /usr/local/nginx/html
wget https://files.phpmyadmin.net/phpMyAdmin/5.1.1/phpMyAdmin-5.1.1-all-languages.tar.gz
  • 解压 & 删除源码压缩包并重命名:
tar -xvf phpMyAdmin*
rm -rf phpMyAdmin-5.1.1-all-languages.tar.gz
mv phpMyAdmin* pmad
  • 拷贝 & 重命名和修改 phpMyAdmin 配置文件:
cp config.sample.inc.php config.inc.php
$cfg['Servers'][$i]['host'] = 'localhost';
/*改为...*/
$cfg['Servers'][$i]['host'] = '12.0.0.1';   /*或你的服务器IP*/
  • 修改 nginx 配置文件 nginx.conf
vim /usr/local/nginx/conf/nginx.conf
location /pmad {alias /usr/local/nginx/html/pmad;index  index.php index.html index.htm;
/*注:已将phpMyAdmin改名为pmad...*/
  • :wq 保存退出,验证语法有无错误:
nginx -t
/*------以下为打印内容...------*/
nginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok
nginx: configuration file /usr/local/nginx/conf/nginx.conf test is successful
/*------以上输出,证明修改无错,可下一步...------*/
  • 进入 mysql 查询一下 mysqli.sock 的路径(知道路径的可省略此步):
mysql -uroot -p'密码'
mysql>  STATUS
-------------------------------------
UNIX socket:        /tmp/mysql.sock
  • 修改 php.ini 配置文件(配置好 mysqli.sock 路径):
/*找到...*/
pdo_mysql.default_socket=
/*=后面添加...*/
pdo_mysql.default_socket=/tmp/mysql.sock
/*找到...*/
mysqli.default_socket =
/*=后面添加...*/
mysqli.default_socket =/tmp/mysql.sock
mysqli.default_port =      /*填上你的mysql端口*/
  • :wq 保存退出,只要你的 php-fpm 在运行中,就不需要进行 php-fpm 的重启操作:

  • 重载 nginx 服务配置:

nginx -s reload
  • 登录 phpMyAdmin

  • 打开浏览器-输入>>:localhost.pmadip/pmad,出现 phpMyAdmin 以下登录界面,则证明设置成功:

  • 在登录页面输入你的 MySQL 用户名 & 密码,即可实现登录数据库:

    • 前提:你已在系统中完成【NMP】nginxapache , mysqlMariaDB& PHP 安装: