phpMyAdmin默认用户名


phpMyAdmin Default Username

我当前的身份验证设置:

/* Authentication type */
$cfg['Servers'][$i]['auth_type'] = 'cookie';

这将提示用户输入数据库用户名和密码。

如何设置默认用户名,并提示用户输入数据库密码

我尝试将我的授权更改为:

$cfg['Servers'][$i]['user']          = 'username';
$cfg['Servers'][$i]['password']      = ''; // use here your password
$cfg['Servers'][$i]['auth_type']     = 'config';

但这不起作用,因为它没有给用户输入密码的选项。

您正在登录数据库,而不是登录phpMyAdmin。。。它使用您的数据库凭据。

据我所知,你所做的应该是有效的。但如果不是,你可以硬编码一个技巧。这是非常肮脏的,所以只有当你需要始终使用相同的用户名(我的意思是,不是以普通的方式)并且是私人使用时才使用。

  • 将用户名和密码保留为配置文件中的空字符串
  • 打开登录表单html文件,然后将用户名硬编码为用户名的文本字段值

如果你能等一段时间,我会为你提供更多具体信息,或者文件的位置和编辑位置。

更新

我明白了。我有phpMyAdmin-4.0.9-english。我想在所有最新版本中都差不多。你必须去

{YOU_PATH_TO_PHPMYADMIN}'libraries'plugins'auth'AuthenticationCookie.class.php

在那里,寻找线路

            <input type="text" name="pma_username" id="input_username" '
            . 'value="' . htmlspecialchars($default_user) . '" size="24"'
            . ' class="textfield"/>

并将htmlspecialchar($default_user)更改为您想要的用户名

 <input type="text" name="pma_username" id="input_username" '
                . 'value="' . htmlspecialchars("YOUR_USERNAME") . '" size="24"'
                . ' class="textfield"/>

我再说一遍,这是一个肮脏的解决方案,我不会考虑永远使用它,但它可以节省你的一天

还有另一种方法,可能更好。输入字段保持原样,然后查找以下行:

// No recall if blowfish secret is not configured as it would produce
    // garbage
    if ($GLOBALS['cfg']['LoginCookieRecall']
        && ! empty($GLOBALS['cfg']['blowfish_secret'])
    ) {
        $default_user   = $GLOBALS['PHP_AUTH_USER'];
        $default_server = $GLOBALS['pma_auth_server'];
        $autocomplete   = '';
    } else {
        $default_user   = '';
        $default_server = '';
        // skip the IE autocomplete feature.
        $autocomplete   = ' autocomplete="off"';
    }

在那里,您可以使用技巧,更改逻辑,或者在下一行中对$default_user值进行硬编码。