Linux 无法登录到 phpMyAdmin,未显示错误
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/11023619/
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
Cannot login to phpMyAdmin, no errors shown
提问by Braden Steffaniak
I have MySQL set up correctly on my linux computer, however I want a better way to input data into the database besides terminal. For this reason, I downloaded phpMyAdmin. However, when I try to log in to the phpMyAdmin from index.php, it doesnt do anything. It seems to just refresh the page without doing anything. I am putting in the correct MySQL username and password. What is the issue?
我在我的 linux 计算机上正确设置了 MySQL,但是除了终端之外,我还想要一种更好的方法将数据输入到数据库中。为此,我下载了 phpMyAdmin。但是,当我尝试从 index.php 登录到 phpMyAdmin 时,它没有做任何事情。它似乎只是刷新页面而不做任何事情。我输入了正确的 MySQL 用户名和密码。问题是什么?
Here is a screen shot of what it shows after I click "go".
这是单击“开始”后显示的屏幕截图。
采纳答案by Mohammad_Hosseini
This is a possible issue when the path to save php_session is not correctly set :
当保存 php_session 的路径设置不正确时,这可能是一个问题:
The directory for storing session does not exists or php do not have sufficient rights to write to it.
存储会话的目录不存在或 php 没有足够的写入权限。
To define the php_session directory simply add the following line to the php.ini :
要定义 php_session 目录,只需将以下行添加到 php.ini :
session.save_path="/tmp/php_session/"
And give write rights to the http server.
并赋予 http 服务器写入权限。
usually, the http server run as user daemon in group daemon. If it is the case, the following commands will make it :
通常,http 服务器作为组守护进程中的用户守护进程运行。如果是这种情况,以下命令将使其成功:
chown -R :daemon /tmp/php_session
chmod -R g+wr /tmp/php_session
service httpd restart
回答by Alexander
- Try searching the web for installation or setup guides for phpMyAdmin. Look at two or three of these and make sure you have covered all the required steps. (If you have already done so, please include which guides you have followed it in the question).
- See if it helps to edit config.inc.php (acecoder mentioned this as well).
- Check if this guideis of any help.
- Which distro are you on? Try searching for the name of the distro you are using together with "phpMyAdmin guide" or "phpMyAdmin setup howto".
- If you encounter errors along the way, post the error text here, if it's short (or paste via a pastebin-like site if it's long).
- 尝试在网络上搜索 phpMyAdmin 的安装或设置指南。查看其中的两三个,并确保您已涵盖所有必需的步骤。(如果您已经这样做了,请在问题中包含您遵循的指南)。
- 看看它是否有助于编辑 config.inc.php (acecoder 也提到了这一点)。
- 检查本指南是否有帮助。
- 你在哪个发行版?尝试搜索您正在使用的发行版名称以及“phpMyAdmin 指南”或“phpMyAdmin 设置方法”。
- 如果在此过程中遇到错误,请在此处发布错误文本,如果它很短(或者如果它很长,则通过类似 pastebin 的站点粘贴)。
回答by John K.
Are you sure that mysql is running? I had the same issue after doing a database import and filling up the volume containing the mysql database. After changing various permissions and clearing sessions, I tried to restart mysql (/etc/init.d/mysql restart) and it failed because the volume was full. After increasing /var and starting mysql successfully, I was able to log into phpmyadmin just fine.
你确定mysql正在运行?在执行数据库导入并填满包含 mysql 数据库的卷后,我遇到了同样的问题。更改各种权限和清除会话后,我尝试重新启动mysql(/etc/init.d/mysql restart),但由于卷已满而失败。增加 /var 并成功启动 mysql 后,我能够很好地登录到 phpmyadmin。
回答by Cokaric
I fixed my issue on CentOS 7 with MariaDB and phpmyadmin I downloaded from offical phpmyadmin site by adding
我通过添加从官方 phpmyadmin 站点下载的 MariaDB 和 phpmyadmin 修复了 CentOS 7 上的问题
session.save_path = "/var/lib/php/session"
to /etc/php.ini
到/etc/php.ini
and
和
chown -R :lighttpd /var/lib/php/session
I also restarted php-fpm and lighttpd after
之后我还重新启动了 php-fpm 和 lighttpd
回答by John
If you have an error like:
如果你有这样的错误:
Host 'host_name' is blocked because of many connection errors.
由于许多连接错误,主机“host_name”被阻止。
Login in your mysql as root and run the flush hosts command
以 root 身份登录您的 mysql 并运行 flush hosts 命令
1.- mysql -u root -p
1.- mysql -u root -p
2.- mysql > flush hosts
2.- mysql > 刷新主机
After this I was able to login again in phpmyadmin
在此之后,我能够在 phpmyadmin 中再次登录
回答by Pacerier
phpMyAdmin will show errors when login fails. If it doesn't, it means that your setup has an error.
phpMyAdmin 将在登录失败时显示错误。如果没有,则表示您的设置有错误。
The most likely place to check is your php.ini
settings. Since there doesn't seem to be an official list of phpMyAdmin-compatible settings, it's mostly trial and error.
最有可能检查的地方是您的php.ini
设置。由于似乎没有与 phpMyAdmin 兼容的设置的官方列表,因此主要是反复试验。
Make sure you have enabled the stuffthat needs to be enabled. Also check that you did not enable uncommonphp.ini settings (like enable_post_data_reading = Off
) because phpMyAdmin assumes them to be "the usual ones".
确保您已启用需要启用的内容。还要检查您是否没有启用不常见的php.ini 设置(如enable_post_data_reading = Off
),因为 phpMyAdmin 假定它们是“常用设置”。
To ease debugging, start with a clean default php.ini
file then tweak them line by line to see which setting is causing the error. (Don't forget that you need to restart your server after changing the php.ini
file for the changes to take place.)
为了便于调试,从一个干净的默认php.ini
文件开始,然后逐行调整它们以查看导致错误的设置。(不要忘记在更改php.ini
文件后需要重新启动服务器才能进行更改。)
回答by Amadu Bah
Login fails if session folder in not writeable. To check that, create a PHP file in your web directory with:
如果会话文件夹不可写,则登录失败。要检查这一点,请在您的 Web 目录中创建一个 PHP 文件:
<?php
$sessionPath = 'undefined';
if (!($sessionPath = ini_get('session.save_path'))) {
$sessionPath = isset($_ENV['TMP']) ? $_ENV['TMP'] : sys_get_temp_dir();
}
if (!is_writeable($sessionPath)) {
echo 'Session directory "'. $sessionPath . '"" is not writeable';
} else {
echo 'Session directory: "' . $sessionPath . '" is writeable';
}
If session folder is not writeable do either
如果会话文件夹不可写,请执行以下任一操作
sudo setfacl -R -m u:www-data:rwx <session directory>
or chmod 777 sudo setfacl -R -m u:www-data:rwx <session directory>
-
sudo setfacl -R -m u:www-data:rwx <session directory>
或 chmod 777 sudo setfacl -R -m u:www-data:rwx <session directory>
-
回答by Gábor G.
In my case the solution was to set an Apache setting properly:
就我而言,解决方案是正确设置 Apache 设置:
ProxyPassReverseCookiePath
This was required, because ProxyPassand ProxyPassReversewere in use, but cookie paths are not changed automatically.
这是必需的,因为ProxyPass和ProxyPassReverse正在使用中,但 cookie 路径不会自动更改。
It'd be great if PHPMyAdmin had shown something like session not found or anything, when password is sent with POST.
如果 PHPMyAdmin 在通过 POST 发送密码时显示诸如找不到会话之类的信息,那就太好了。
回答by David
In my case it was due to an old Apache session.
Stop Apache, clear all pending sessions in your sessions.save_path
directory (example: /var/lib/php/session
) and restart Apache.
就我而言,这是由于旧的 Apache 会话。停止 Apache,清除sessions.save_path
目录中所有挂起的会话(例如/var/lib/php/session
:)并重新启动 Apache。
回答by Calmarius
Do you have a .htaccess file in one of the parent directories that strips off index.php from the url by doing a 301 redirect?
您是否在父目录之一中有一个 .htaccess 文件,该文件通过执行 301 重定向从 url 中剥离了 index.php?
301 redirects discard the form data and redirect you as if you didn't submit anything. So you get returned to the login page.
301 重定向会丢弃表单数据并将您重定向,就好像您没有提交任何内容一样。所以你会返回到登录页面。
So you should create a local .htaccess file in the phpmyadmin directory with a single line RewriteEngine On
. This will overwrite the previous rewrite rule to nothing.
因此,您应该在 phpmyadmin 目录中创建一个本地 .htaccess 文件,其中包含一行RewriteEngine On
。这会将之前的重写规则覆盖为空。
You may need to clear the browser cache as Chrome aggressively caches 301 redirects.
您可能需要清除浏览器缓存,因为 Chrome 会主动缓存 301 重定向。