php 如何禁用 phpMyAdmin 登录页面?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/3795993/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How can I disable the phpMyAdmin login page?
提问by pliashkou
I use phpmyadmin, and when entering this adress:
我使用 phpmyadmin,当输入这个地址时:
www.mydomain.com/phpmyadmin
a login page appears.
出现登录页面。
Is there any way of disabling it, so it doesn't appear/exist?
有没有办法禁用它,所以它不出现/存在?
Thanks
谢谢
采纳答案by Ian Wood
Yep, you can: set your password in the config file. BUT if you are using this on your domain then I'd strongly recommend you take it off your site altogether!
是的,您可以: 在配置文件中设置您的密码。但是,如果您在您的域上使用它,那么我强烈建议您将其完全从您的网站上删除!
Use a client to access your database - like mysql workbench or mysql yog or any of the numerous ones out there.
使用客户端访问您的数据库 - 像 mysql workbench 或 mysql yog 或那里众多的任何一个。
If you MUST use phpmyadmin then why not install it on your local machine and add the details to the config there? It is much safer.
如果您必须使用 phpmyadmin 那么为什么不将它安装在您的本地机器上并将详细信息添加到那里的配置中呢?它更安全。
回答by Litehouse
You can disable phpMyAdmin by disabling the module configuration.
您可以通过禁用模块配置来禁用 phpMyAdmin。
sudo a2disconf phpmyadmin.conf
sudo /etc/init.d/apache2 restart
Enable it with
启用它
sudo a2enconf phpmyadmin.conf
sudo /etc/init.d/apache2 restart
回答by pliashkou
In your config.inc.php file change:
在您的 config.inc.php 文件中更改:
$cfg['Servers'][$i]['auth_type'] = 'config';
and add
并添加
$cfg['Servers'][$i]['user'] = 'root';
$cfg['Servers'][$i]['password'] = 'password';
回答by toxotes
In centos, locate the file in directory /etc/httpd/conf.d/phpmyadmin.conf/
and uncomment these lines to only give access on the local system to phpmyadmin, and leave the users from outside with no access to phpmyadmin
在centos中,找到目录中的文件/etc/httpd/conf.d/phpmyadmin.conf/
并取消注释这些行,只允许phpmyadmin访问本地系统,而让外部用户无法访问phpmyadmin
<Directory "/usr/share/phpmyadmin">
Order Deny,Allow
Deny from all
Allow from 127.0.0.1
</Directory>
Hope this be helpfull
希望这会有所帮助
回答by Hyman Gerson
Just an idea. If someone must have PhpMyAdmin installed, it is also possible to "hide it" under another url.
只是一个想法。如果有人必须安装 PhpMyAdmin,也可以在另一个 url 下“隐藏它”。
In case of a Debian/Apache web server find the apache.conf
in the phpmyadmin directory and change:
如果是 Debian/Apache Web 服务器,请apache.conf
在 phpmyadmin 目录中找到并更改:
Alias /phpmyadmin /usr/share/phpmyadmin
to
Alias /yourspecialurl /usr/share/phpmyadmin
Alias /phpmyadmin /usr/share/phpmyadmin
到
Alias /yourspecialurl /usr/share/phpmyadmin
Don't forget to restart Apache with the new config...
不要忘记使用新配置重新启动Apache ...
回答by KawaiKx
Preventing remote login doesn't stop access to phpmyadminif you have not stopped it in /etc/phpmyadmin/apache.conf
如果您尚未在 /etc/phpmyadmin/apache.conf 中停止访问,则阻止远程登录不会停止对 phpmyadmin 的访问
To turn the access to phpmyadmin OFF in ubuntu 14.04 with apacheweb server, edit /etc/phpmyadmin/apache.conf
要使用 apache网络服务器在 ubuntu 14.04 中关闭对 phpmyadmin 的访问,请编辑 /etc/phpmyadmin/apache.conf
Search for or if you set the Alias /phpmyadmin /usr/share/phpmyadmin in the same file.
搜索或是否在同一文件中设置别名 /phpmyadmin /usr/share/phpmyadmin。
Add or Edit following lines: Order Deny, Allow Deny from all
添加或编辑以下行:Order Deny、Allow Deny from all
Restart apache2with sudo service apache2 restart
重新启动的Apache2使用sudo服务的Apache2重启
To turn the access to phpmyadmin ON temporarily, first find out your ip address. Search Google, what is my ip address. Then edit vi /etc/phpmyadmin/apache.conf file. Add this line to the above mentioned Directory tag: Allow from
要暂时打开对 phpmyadmin 的访问,首先要找出您的 IP 地址。搜索谷歌,我的IP地址是什么。然后编辑 vi /etc/phpmyadmin/apache.conf 文件。将此行添加到上述目录标记中:允许来自
Restart the apache2 with sudo service apache2 restart
使用 sudo service apache2 restart 重新启动 apache2
回答by Jared
One thing you may want to do is just use a .htaccess
file to redirect that URL somewhere to basically restrict the ability to get to that URL.
您可能想要做的一件事就是使用一个.htaccess
文件将该 URL 重定向到某个地方,以基本上限制访问该 URL 的能力。
To do this, just create a .htaccess
file at the root directory of your domain and put this in it:
为此,只需.htaccess
在域的根目录中创建一个文件并将其放入其中:
Redirect 301 /phpmyadmin http://www.mydomain.com/
Then whenever you need to access phpmyadmin, you would just have to comment out that line temporarily while you do your work.
然后,每当您需要访问 phpmyadmin 时,您只需在工作时暂时注释掉该行。
回答by Lo?c Février
If you disable it then anyone trying that URL will have immediate access to you mysql database and could do anything, including deleting them. The password is here for a reason !
如果您禁用它,那么任何尝试该 URL 的人都可以立即访问您的 mysql 数据库,并且可以做任何事情,包括删除它们。密码在这里是有原因的!
But, there might be a valid reason to do that, maybe you are protecting the directory with an other security ?
但是,这样做可能有正当的理由,也许您正在使用其他安全保护目录?
回答by Selvam
To disable PhpMyAdmin page need to edit an configuration file as below
要禁用 PhpMyAdmin 页面需要编辑配置文件如下
vi /opt/lampp/etc/extra/httpd-xampp.conf around 64th line edit:
vi /opt/lampp/etc/extra/httpd-xampp.conf 大约第 64 行编辑:
Deny from all
TO
Deny from none
Order deny,allow Deny from all /*none*/ Allow from ::1 127.0.0.0/8 \ fc00::/7 10.0.0.0/8 172.16.0.0/12 192.168.0.0/16 \ fe80::/10 169.254.0.0/16
Order deny,allow Deny from all /*none*/ Allow from ::1 127.0.0.0/8 \ fc00::/7 10.0.0.0/8 172.16.0.0/12 192.168.0.0/16 \ fe80::/10 169.254.0.0/16
回答by Tom
You can remove it completely with this command:
您可以使用以下命令将其完全删除:
sudo apt-get purge phpmyadmin