在Linux(包括Ubuntu)下快速安装Phpmyadmin

本文详述了在Linux(Ubuntu)系统中安装Phpmyadmin的步骤,包括安装Mysql server、Apache,以及如何配置和安全设置Phpmyadmin。用户需先安装Mysql,接着安装Apache,然后通过命令行安装Phpmyadmin并设置密码。最后,文章提到了通过Apache的.htaccess进行安全保护的可选步骤。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

在Linux(包括Ubuntu)下快速安装Phpmyadmin

完整安装PHPmyadmin共包含三个大步骤:

  • 安装Mysql server
  • 安装Apache
  • 安装PHPmyadmin

一、第一步 安装Mysql server

这一步参考我的博客 在Linux下安装Mysql

二、第二步 安装apache

在终端(Terminal)中输入下面的安装命令即可:

$ sudo apt-get update
$ sudo apt-get install apache2

检查Apache是否已经正确安装,只需在浏览器中输入你安装Apache的机器的IP地址,出现Apache页面,并有“It works”字样即可。

下面的命令可以查看你Apache服务器的IP地址:

$ ifconfig eth0 | grep inet | awk '{ print $2 }

第三步 安装Phpmyadmin

在命令行输入命令:

$ sudo apt-get update
$ sudo apt-get install phpmyadmin php-mbstring php-gettext

在安装过程中会询问你一些问题:

  • 第一个弹出的问题: 要用空格Space选中他们才能Enter继续
  • 第二个弹出的问题:问你是否使用dbconfig-common来配置数据库,然后让你输入之前安装的mysql的密码
    然后,会让你配置你的PHPmyadmin的密码和确认密码

安装的过程会将PHPmyadmin和Apache的配置文件写入到/etc/apache2/conf-enabled/目录下,在PHPmyadmin和Apache运行的时候会自动从这里读取配置信息。

接下来是激活PHP的mcrypt和mbstring扩展,通过下面的命令:

$ sudo phpenmod mcrypt
$ sudo phpenmod mbstring

然后重启Apache:

$ sudo systemctl restart apache2

通过浏览器访问:

https://domain_name_or_IP/phpmyadmin

登录页面的账号密码就是上面设置过的。
这里写图片描述

(可选步骤)

Step Two — Secure your phpMyAdmin Instance
We were able to get our phpMyAdmin interface up and running fairly easily. However, we are not done yet. Because of its ubiquity, phpMyAdmin is a popular target for attackers. We should take extra steps to prevent unauthorized access.

One of the easiest way of doing this is to place a gateway in front of the entire application. We can do this using Apache’s built-in .htaccess authentication and authorization functionalities.

Configure Apache to Allow .htaccess Overrides

First, we need to enable the use of .htaccess file overrides by editing our Apache configuration file.

We will edit the linked file that has been placed in our Apache configuration directory:

sudo nano /etc/apache2/conf-available/phpmyadmin.conf
We need to add an AllowOverride All directive within the

Reference:

https://www.digitalocean.com/community/tutorials/how-to-install-and-secure-phpmyadmin-on-ubuntu-16-04

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值