“配置中定义的 controluser 连接失败"在 XAMPP 中使用 phpMyAdmin [英] "Connection for controluser as defined in your configuration failed" with phpMyAdmin in XAMPP

查看:18
本文介绍了“配置中定义的 controluser 连接失败"在 XAMPP 中使用 phpMyAdmin的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚在我的 Windows XP 机器上安装了 XAMPP,我收到一条错误消息:

I have just installed XAMPP on my Windows XP machine, and I get an error saying:

配置中定义的 controluser 连接失败.

Connection for controluser as defined in your configuration failed.

在我安装 XAMPP 之前,我已经安装了一个 MySQL 数据库并且它有一个密码.我更改了密码并将其放入 MySQL 的 config.inc.php 中,但出现此错误:

Before I installed XAMPP, I had a MySQL database installed and it had a password. I changed and put the password in config.inc.php for MySQL, and I got this error:

<?php
if (!empty($_SERVER['HTTPS']) && ('on' == $_SERVER['HTTPS'])) {
    $uri = 'https://';
} else {
    $uri = 'http://';
}
$uri .= $_SERVER['HTTP_HOST'];
header('Location: '.$uri.'/xampp/');
exit;
?>

当我尝试访问 index.php 时,XAMPP 安装似乎有问题.我该怎么做才能解决这个问题?

When I try to access index.php, it seems like something is wrong with the XAMPP installation. What can I do to fix this problem?

推荐答案

  1. 在浏览器中打开 phpMyAdmin 并以 root 身份登录.
  2. 创建一个名为 phpmyadmin
  3. 的数据库
  4. 创建一个名为 pma 的用户并将主机"设置为您的 Web 服务器的主机名或 IP 地址(如果 Web 服务器和 MySQL 在同一个盒子上,请使用 localhost),记下密码,并授予新用户对 phpmyadmin 数据库的完全控制权.建议此用户无权访问此数据库以外的任何内容.
  5. 转到 phpMyAdmin 安装目录,您应该在其中找到一个名为 sql 的子目录.
  6. sql 中,您会找到一个名为 create_tables.sql 的文件.在文本编辑器中打开它.
  7. 在 phpMyAdmin 中,选择 phpmyadmin 数据库并点击SQL"选项卡.
  8. create_tables.sql 中的整个文本复制/粘贴到文本框中,然后运行查询.
  9. 打开 phpMyAdmin 安装目录中的 config.inc.php 文件,并添加以下行(或更改现有设置,如果它们已经存在):

  1. Open phpMyAdmin in a browser and log in as root.
  2. Create a database called phpmyadmin
  3. Create a user called pma and set the "host" to the hostname or IP address of your web server (if the web server and MySQL are on the same box use localhost), make a note of the password, and grant the new user full control over the phpmyadmin database. It is recommended that this user does not have access to anything other than this database.
  4. Go to the phpMyAdmin installation directory, where you should find a sub-directory called sql.
  5. In sql you will find a file called create_tables.sql. Open it in a text editor.
  6. In phpMyAdmin, select the phpmyadmin database and click on the "SQL" tab.
  7. Copy/paste the entire text from create_tables.sql into the text box, and run the query.
  8. Open the config.inc.php file in the phpMyAdmin install directory, and add the following lines (or change the existing settings if they are already there):

$cfg['Servers'][1]['pmadb'] = 'phpmyadmin';
$cfg['Servers'][1]['controluser'] = 'pma';
$cfg['Servers'][1]['controlpass'] = '<your password>';

// Note: The list below may grow as PMA evolves and more control tables are added
// Use your common sense! Don't just blindly copypasta, look at what it means!
$cfg['Servers'][1]['bookmarktable'] = 'pma_bookmark';
$cfg['Servers'][1]['relation'] = 'pma_relation';
$cfg['Servers'][1]['userconfig'] = 'pma_userconfig';
$cfg['Servers'][1]['table_info'] = 'pma_table_info';
$cfg['Servers'][1]['column_info'] = 'pma_column_info';
$cfg['Servers'][1]['history'] = 'pma_history';
$cfg['Servers'][1]['recent'] = 'pma_recent';
$cfg['Servers'][1]['table_uiprefs'] = 'pma_table_uiprefs';
$cfg['Servers'][1]['tracking'] = 'pma_tracking';
$cfg['Servers'][1]['table_coords'] = 'pma_table_coords';
$cfg['Servers'][1]['pdf_pages'] = 'pma_pdf_pages';
$cfg['Servers'][1]['designer_coords'] = 'pma_designer_coords';

  • 保存并关闭文件.

  • Save and close the file.

    重要提示 - PMA 在登录时加载配置,对其进行评估并将其存储到会话数据中,因此在您执行此操作之前消息不会消失:

    IMPORTANT - PMA loads the config on login, evaluates it and stores it into the session data so the message will not disappear until you do this:

    1. 退出 phpMyAdmin 并重新登录

    问题解决了.

    这篇关于“配置中定义的 controluser 连接失败"在 XAMPP 中使用 phpMyAdmin的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

  • 查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆