本地phpMyAdmin需要登录

时间:2014-10-25 08:15:10

标签: phpmyadmin

在我的本地phpMyAdmin中我必须登录到系统并且在一段时间后我失去了会话,但在我的配置/etc/phpmyadmin/config.inc.php中 有行:

/* Uncomment the following to enable logging in to passwordless accounts,
 * after taking note of the associated security risks. */
$cfg['Servers'][$i]['AllowNoPassword'] = TRUE;
$cfg['Servers'][$i]['user'] = 'root';

我是否需要设置更多选项才能在不登录的情况下输入phpMyAdmin?

  

服务器版本:5.5.38-0ubuntu0.14.04.1 - (Ubuntu)phpMyAdmin   版本信息:4.0.10deb1

2 个答案:

答案 0 :(得分:0)

添加以下内容:

$cfg['Servers'][$i]['auth_type']    = 'config'; // instead of cookie
$cfg['Servers'][$i]['password']     = '1234'; // use your MySQL root password

根据我的经验,这很有效。

答案 1 :(得分:0)

正如该评论所述(并且如phpMyAdmin文档中所述),AllowNoPassword行允许您登录没有密码的帐户。例如,默认情况下,许多MySQL安装使用带有空密码的用户名root;默认情况下,phpMyAdmin不允许这样做,因为它会成为面向公众的服务器上的一大安全漏洞。 AllowNoPassword指令更改了该行为;它与您是否真的必须登录或会话持续多长时间无关。

如果您希望在连接时根本不提示,可以使用auth_type config。结合硬编码您的用户名和密码($cfg['Servers'][$i]['user']$cfg['Servers'][$i]['password']指令),您将永远不会被提示。这些仅用于auth_type config。

无论如何,这听起来根本不是你的问题,因为你特意提到在一段时间后失去会话。会话到期由两个因素控制;整个PHP限制和一个phpMyAdmin。 phpMyAdmin限制由$cfg['LoginCookieValidity']指令控制,但受PHP设置session.gc_maxlifetime的限制。

因此,为了增加会话的长度,您需要增加LoginCookieValidity指令,但如果将其增加到高于全局PHP gc_maxlifetime的值,那么您还必须增加该值以匹配。