phpmyadmin 免登陆


第0步:

打开 phpmyadmin/libraries/config.default.php

找到以下的代码。填上username和password:

/**
 * MySQL user
 *
 * @global string $cfg['Servers'][$i]['user']
 */
$cfg['Servers'][$i]['user'] = '这里填username';

/**
 * MySQL password (only needed with 'config' auth_type)
 *
 * @global string $cfg['Servers'][$i]['password']
 */
$cfg['Servers'][$i]['password'] = '这里填密码';



第一步:

打开 phpmyadmin/libraries/plugins/auth/AuthenticationCookie.class.php

找到 authCheck 和 authSetUser 两个函数的定义,在函数体最前面直接加个 return true; 就是让这两个函数不管何时都仅仅返回 true。


经过第一步后,你每次打开phpmyadmin 都能够不用登陆自己主动进入 dashboard 了,可是仍然会在你长时间不操作之后提示你 token 已过期,须要又一次刷新一下页面。

所以第二步就是解决问题的。


第二步:

打开 phpmyadmin/libraries/common.inc.php

找到以下这段代码:

$token_mismatch = true;
if (PMA_isValid($_REQUEST['token'])) {
    $token_mismatch = ($_SESSION[' PMA_token '] != $_REQUEST['token']);
}

在它后面插入一句:

$token_mismatch = false;


原文地址:https://www.cnblogs.com/yutingliuyl/p/6742053.html