我在Ubuntu上安装了phpMyAdmin,但它无法正常工作。

5
我在我的Ubuntu 10.4上安装了phpMyAdmin,但是无法登录。
以下是“/etc/phpmyadmin/config.inc.php”文件的内容。
如果我们输入密码,则会出现“#2002无法登录MySQL服务器”的错误。
如果我们没有输入密码,则会出现“配置禁止无密码登录(请参见AllowNoPassword)”的错误。
你能帮我吗?



<p>/**
 * Debian local configuration file
 *
 * This file overrides the settings made by phpMyAdmin interactive setup
 * utility.
 *
 * For example configuration see /usr/share/doc/phpmyadmin/examples/config.default.php.gz
 *
 * NOTE: do not add security sensitive data to this file (like passwords)
 * unless you really know what you're doing. If you do, any user that can
 * run PHP or CGI on your webserver will be able to read them. If you still
 * want to do this, make sure to properly secure the access to this file
 * (also on the filesystem level).
 */</p>

<p>/**
 * Server(s) configuration
 */
$i = 0;
// The $cfg['Servers'] array starts with $cfg['Servers'][1].  Do not use $cfg['Servers'][0].
// You can disable a server config entry by setting host to ''.
$i++;</p>

<p>/**
 * Read configuration from dbconfig-common
 * You can regenerate it using: dpkg-reconfigure -plow phpmyadmin
 */
if (is_readable('/etc/phpmyadmin/config-db.php')) {
    require('/etc/phpmyadmin/config-db.php');
}</p>

<p>/* Configure according to dbconfig-common if enabled <em>/
if (!empty($dbname)) {
    /</em> Authentication type */
    $cfg['Servers'][$i]['auth_type'] = 'cookie';
    /* Server parameters */
    if (empty($dbserver)) $dbserver = 'localhost';
    $cfg['Servers'][$i]['host'] = $dbserver;</p>

<pre><code>if (!empty($dbport)) {
    $cfg['Servers'][$i]['connect_type'] = 'tcp';
    $cfg['Servers'][$i]['port'] = $dbport;
}
//$cfg['Servers'][$i]['compress'] = false;
/* Select mysqli if your server has it */
$cfg['Servers'][$i]['extension'] = 'mysqli';
/* Optional: User for advanced features */
$cfg['Servers'][$i]['controluser'] = $dbuser;

$cfg['Servers'][$i]['controlpass'] = $dbpass; /* Optional: Advanced phpMyAdmin features */ $cfg['Servers'][$i]['pmadb'] = $dbname; $cfg['Servers'][$i]['bookmarktable'] = 'pma_bookmark'; $cfg['Servers'][$i]['relation'] = 'pma_relation'; $cfg['Servers'][$i]['table_info'] = 'pma_table_info'; $cfg['Servers'][$i]['table_coords'] = 'pma_table_coords'; $cfg['Servers'][$i]['pdf_pages'] = 'pma_pdf_pages'; $cfg['Servers'][$i]['column_info'] = 'pma_column_info'; $cfg['Servers'][$i]['history'] = 'pma_history'; $cfg['Servers'][$i]['designer_coords'] = 'pma_designer_coords';

/* Uncomment the following to enable logging in to passwordless accounts,
 * after taking note of the associated security risks. */

// $cfg['Servers'][$i]['AllowNoPassword'] = TRUE;

/* Advance to next server for rest of config */
$i++;

}

/* Authentication type */ //$cfg['Servers'][$i]['auth_type'] = 'cookie'; /* Server parameters */ //$cfg['Servers'][$i]['host'] = 'localhost'; //$cfg['Servers'][$i]['connect_type'] = 'tcp'; //$cfg['Servers'][$i]['compress'] = false; /* Select mysqli if your server has it / //$cfg['Servers'][$i]['extension'] = 'mysql'; / Optional: User for advanced features / // $cfg['Servers'][$i]['controluser'] = 'pma'; // $cfg['Servers'][$i]['controlpass'] = 'pmapass'; / Optional: Advanced phpMyAdmin features */ // $cfg['Servers'][$i]['pmadb'] = 'phpmyadmin'; // $cfg['Servers'][$i]['bookmarktable'] = 'pma_bookmark'; // $cfg['Servers'][$i]['relation'] = 'pma_relation'; // $cfg['Servers'][$i]['table_info'] = 'pma_table_info'; // $cfg['Servers'][$i]['table_coords'] = 'pma_table_coords'; // $cfg['Servers'][$i]['pdf_pages'] = 'pma_pdf_pages'; // $cfg['Servers'][$i]['column_info'] = 'pma_column_info'; // $cfg['Servers'][$i]['history'] = 'pma_history'; // $cfg['Servers'][$i]['designer_coords'] = 'pma_designer_coords'; /* Uncomment the following to enable logging in to passwordless accounts, * after taking note of the associated security risks. */ // $cfg['Servers'][$i]['AllowNoPassword'] = TRUE;

/* * End of servers configuration */

/* * Directories for saving/loading files from server */ $cfg['UploadDir'] = ''; $cfg['SaveDir'] = '';


你收到了什么错误信息? - clifgriffin
请更具体地说明它是如何无法工作的。PMA Web控制台没有加载吗?它无法连接到MySQL吗? - wkl
有时将主机从“localhost”更改为“127.0.0.1”可能会奏效,但这完全取决于您遇到的错误。 - KJYe.Name
如果我们输入密码#2002,则无法登录到MySQL服务器。 - 22francis
如果我们没有输入密码,则禁止无密码登录,这是由配置文件决定的(请参见AllowNoPassword)。 - 22francis
2个回答

5

如果您使用的是空密码,请取消注释:

// $cfg['Servers'][$i]['AllowNoPassword'] = TRUE;

如果您在隔离的开发虚拟机内,则是安全的,否则请设置密码。


我按照这个链接操作,现在一切正常。 - 22francis

3

我遇到了同样的问题,但我认为我已经解决了它...

解决办法:假设您使用setup.php文件来设置phpMyAdmin,在配置完mysql服务器并保存更改后,将自动生成在config/文件夹中的config.inc.php文件复制到phpMyAdmin文件夹中... 确保它是写保护的并删除config/文件夹... 然后刷新浏览器...

对我有用.. 希望对你也有用。

谢谢。


谢谢,但我已经通过自己的努力解决了问题,通过删除所有内容并安装全新的副本。 - 22francis

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接