如何限制对 phpMyAdmin 中特定数据库用户帐户的访问?

How do I restrict access to specific database user accounts in phpMyAdmin?

我希望能够限制对特定数据库用户帐户的访问,或阻止特定数据库用户帐户通过 phpMyAdmin 登录。我如何配置 phpMyAdmin 来执行此操作?

具体来说,我是 运行 phpMyAdmin Ubuntu 服务器。我想知道如何通过网络服务器或 OS.[=10 在 phpMyAdmin 本身 not 级别配置它=]

要配置 phpMyAdmin,您需要找到 config.inc.php 配置文件。在 Ubuntu,它位于 /etc/phpmyadmin。编辑此文件。

在以 $i++.

结尾的块 之后 添加行

默认情况下拒绝所有用户访问,然后允许特定用户:

$cfg['Servers'][$i]['AllowDeny']['order'] = 'explicit';
$cfg['Servers'][$i]['AllowDeny']['rules'] = [
    'allow alex from all'
];

默认允许所有用户访问,然后拒绝特定用户:

$cfg['Servers'][$i]['AllowDeny']['order'] = 'deny,allow';
$cfg['Servers'][$i]['AllowDeny']['rules'] = [
    'deny alex from all'
];

您可以用模式替换 all 以匹配特定的 IP 地址或地址范围。请参阅 phpMyAdmin docs.

中的完整文档