简体   繁体   English

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

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

I'd like to be able to either restrict access to specific database user accounts, or block specific database user accounts from logging in via phpMyAdmin. 我希望能够限制对特定数据库用户帐户的访问,或者阻止特定数据库用户帐户通过phpMyAdmin登录。 How can I configure phpMyAdmin to do this? 如何配置phpMyAdmin来做到这一点?

Specifically, I'm running phpMyAdmin Ubuntu server. 具体来说,我正在运行phpMyAdmin Ubuntu服务器。 I want to know how to configure this at the level of phpMyAdmin itself , and not through the webserver or OS. 我想知道如何在phpMyAdmin 本身级别而不是通过Web服务器或OS进行配置。

To configure phpMyAdmin, you need to find your config.inc.php configuration file. 要配置phpMyAdmin,您需要找到config.inc.php配置文件。 On Ubuntu, this is located in /etc/phpmyadmin . 在Ubuntu上,该文件位于/etc/phpmyadmin Edit this file. 编辑此文件。

Add lines to this file after the block that ends with $i++ . $i++结尾的块之后 ,向该文件中添加行。

To deny access to all users by default, and then allow specific users: 默认情况下要拒绝对所有用户的访问,然后允许特定用户:

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

To allow access to all users by default, and then deny specific users: 默认情况下要允许访问所有用户,然后拒绝特定用户,请执行以下操作:

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

You can replace all with patterns to match specific IP addresses or ranges of addresses. 您可以将all模式替换为与特定IP地址或地址范围匹配的模式。 See the full documentation at the phpMyAdmin docs . 请参阅phpMyAdmin文档中的完整文档。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM