如何在 CentOS 7 上安装 phpMyAdmin

在本教程中,我们将向您展示如何在 CentOS 7 上安装 phpMyAdmin。对于那些不知道的人,phpMyAdmin 是一个用 PHP 编写的基于 Web 的客户端,用于管理 MySQL 和 MariaDB 数据库。 它提供了一个用户友好的 Web 界面来访问和管理您的数据库。 为了方便更多人使用,phpMyAdmin 正在被翻译成 72 种语言,并支持 LTR 和 RTL 语言。

本文假设您至少具备 Linux 的基本知识,知道如何使用 shell,最重要的是,您将网站托管在自己的 VPS 上。 安装非常简单。 我将向您展示在 CentOS 7 上的分步安装 phpMyAdmin。

先决条件

  • 运行以下操作系统之一的服务器:CentOS 7。
  • 建议您使用全新的操作系统安装来防止任何潜在问题。
  • 对服务器的 SSH 访问(或者如果您在桌面上,则只需打开终端)。
  • 一种 non-root sudo user或访问 root user. 我们建议充当 non-root sudo user,但是,如果您在充当 root 时不小心,可能会损害您的系统。

在 CentOS 7 上安装 phpMyAdmin

步骤 1. 首先,确保所有软件包都是最新的。

yum - update

步骤 2. 安装 LAMP 服务器。

需要 CentOS 7 LAMP 服务器。 如果您没有安装 LAMP,您可以在此处按照我们的指南进行操作。

步骤 3. 在 CentOS 7 上安装 phpMyAdmin。

为了在 CentOS 7 上快速安装 phpMyAdmin,我们将安装 企业 Linux 的额外软件包(EPEL) repo 首先运行以下命令:

yum install epel-release

之后,运行以下命令安装 phpMyAdmin:

yum install phpmyadmin

步骤 4. 配置 phpMyAdmin。

phpMyAdmin 默认只允许从 localhost 访问。 如果您想从远程计算机访问它,请编辑 /etc/httpd/conf.d/phpMyAdmin.conf 并使用您的网络更新所有 127.0.0.1,如下所示,或为所有人启用 phpMyAdmin 访问:

Alias /phpMyAdmin /usr/share/phpMyAdmin Alias /phpmyadmin /usr/share/phpMyAdmin  ## Comment below section to allow everyone  <Directory /usr/share/phpMyAdmin/>     <IfModule !mod_authz_core.c>      Order Deny,Allow      Deny from All      Allow from 192.168.1.0/24      Allow from ::1    </IfModule> </Directory>  <Directory /usr/share/phpMyAdmin/libraries/>     Order Deny,Allow     Deny from All     Allow from None </Directory>  <Directory /usr/share/phpMyAdmin/setup/lib/>     Order Deny,Allow     Deny from All     Allow from None </Directory>  <Directory /usr/share/phpMyAdmin/setup/frames/>     Order Deny,Allow     Deny from All     Allow from None </Directory>

现在,我们可以重新启动 Apache 以便发生更改:

systemctl restart httpd.service

步骤 5. 访问 phpMyAdmin。

现在打开浏览器并浏览 https://your-ip-address/phpMyAdmin 并且您的 PHPMyAdmin 会询问您安装 MySQL 的用户名和密码,您可以使用 root 作为用户和 root MySQL 密码,或任何其他 MySQL 用户/密码。 如果您使用防火墙,请打开端口 80 以启用对控制面板的访问。

恭喜! 您已成功安装 phpMyAdmin。 感谢您使用本教程在 CentOS 7 系统上安装 phpMyAdmin。 如需更多帮助或有用信息,我们建议您查看 phpMyAdmin 官方网站.

Save