“在配置中定义的控制用户的连接失败";在XAMPP中使用phpMyAdmin [英] "Connection for controluser as defined in your configuration failed" with phpMyAdmin in XAMPP
问题描述
我刚刚在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?
推荐答案
- 在浏览器中打开phpMyAdmin并以root用户身份登录.
- 创建一个名为
phpmyadmin
的数据库
- 创建一个名为
pma
的用户,并将主机"设置为Web服务器的主机名或IP地址(如果Web服务器和MySQL在同一框上,请使用localhost
),并记下密码,并授予新用户对phpmyadmin
数据库的完全控制权.建议该用户除此数据库外无权访问其他任何内容. - 转到phpMyAdmin安装目录,您应在其中找到一个名为
sql
的子目录. - 在
sql
中,您将找到一个名为create_tables.sql
的文件.在文本编辑器中将其打开. - 在phpMyAdmin中,选择
phpmyadmin
数据库,然后单击"SQL"选项卡. - 将
create_tables.sql
中的整个文本复制/粘贴到文本框中,然后运行查询. -
在phpMyAdmin安装目录中打开
config.inc.php
文件,并添加以下几行(或更改现有设置,如果它们已经存在的话):
- Open phpMyAdmin in a browser and log in as root.
- Create a database called
phpmyadmin
- 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 uselocalhost
), make a note of the password, and grant the new user full control over thephpmyadmin
database. It is recommended that this user does not have access to anything other than this database. - Go to the phpMyAdmin installation directory, where you should find a sub-directory called
sql
. - In
sql
you will find a file calledcreate_tables.sql
. Open it in a text editor. - In phpMyAdmin, select the
phpmyadmin
database and click on the "SQL" tab. - Copy/paste the entire text from
create_tables.sql
into the text box, and run the query. 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:
- 退出phpMyAdmin,然后再次登录
问题解决了.
这篇关于“在配置中定义的控制用户的连接失败";在XAMPP中使用phpMyAdmin的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!