php XAMPP 中的 phpMyAdmin 出现“配置中定义的 controluser 连接失败”
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/11506224/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
"Connection for controluser as defined in your configuration failed" with phpMyAdmin in XAMPP
提问by Or Cohen
I have just installed XAMPP on my Windows XP machine, and I get an error saying:
我刚刚在我的 Windows XP 机器上安装了 XAMPP,我收到一条错误消息:
Connection for controluser as defined in your configuration failed.
配置中定义的 controluser 连接失败。
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:
在我安装 XAMPP 之前,我安装了一个 MySQL 数据库并且它有一个密码。我更改并将密码放在 config.inc.php for MySQL 中,但出现此错误:
<?php
if (!empty($_SERVER['HTTPS']) && ('on' == $_SERVER['HTTPS'])) {
$uri = 'https://';
} else {
$uri = 'http://';
}
$uri .= $_SERVER['HTTP_HOST'];
header('Location: '.$uri.'/xampp/');
exit;
?>
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?
当我尝试访问 index.php 时,XAMPP 安装似乎有问题。我能做些什么来解决这个问题?
回答by DaveRandom
- Open phpMyAdmin in a browser and log in as root.
- Create a database called
phpmyadmin - Create a user called
pmaand 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 thephpmyadmindatabase. 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
sqlyou will find a file calledcreate_tables.sql. Open it in a text editor. - In phpMyAdmin, select the
phpmyadmindatabase and click on the "SQL" tab. - Copy/paste the entire text from
create_tables.sqlinto the text box, and run the query. Open the
config.inc.phpfile 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.
- 在浏览器中打开 phpMyAdmin 并以 root 身份登录。
- 创建一个名为
phpmyadmin - 创建一个名为的用户
pma并将“主机”设置为您的 Web 服务器的主机名或 IP 地址(如果 Web 服务器和 MySQL 在同一个框中使用localhost),记下密码,并授予新用户完全控制权该phpmyadmin数据库。建议此用户不能访问此数据库以外的任何内容。 - 转到 phpMyAdmin 安装目录,您应该在其中找到一个名为
sql. - 在
sql你会发现一个名为create_tables.sql。在文本编辑器中打开它。 - 在 phpMyAdmin 中,选择
phpmyadmin数据库并单击“SQL”选项卡。 - 将整个文本复制/粘贴
create_tables.sql到文本框中,然后运行查询。 打开
config.inc.phpphpMyAdmin 安装目录中的文件,并添加以下行(或更改现有设置,如果它们已经存在):$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';保存并关闭文件。
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:
重要- PMA 在登录时加载配置,对其进行评估并将其存储到会话数据中,因此在您执行此操作之前消息不会消失:
- Log out of phpMyAdmin and log in again
- 退出phpMyAdmin并重新登录
Problem solved.
问题解决了。
回答by Or Cohen
If you got here and you are using Debian/Ubuntu (or any other dpkg based distro), execute the following command:
如果您到达这里并且您正在使用 Debian/Ubuntu(或任何其他基于 dpkg 的发行版),请执行以下命令:
sudo dpkg-reconfigure phpmyadmin
The phpmyadmin package contains the script to perform this operation for you, all it needs is a user with permissions. sudo is not required if you're logged in as root, of course.
phpmyadmin 包包含为您执行此操作的脚本,它只需要一个具有权限的用户。当然,如果您以 root 身份登录,则不需要 sudo。
EDIT: It might be worth trying to drop the current phpmyadmin user.
编辑:可能值得尝试删除当前的 phpmyadmin 用户。
回答by streak
Just comment out the whole "User for advanced features" and "Advanced phpMyAdmin features" code blocks in config.inc.php.
只需在config.inc.php.
回答by Ben
Have you recently changed your MySQL Server root password? If answer is YES, than this is the cause of the error / warning inside phpMyAdmin console. To fix the problem, simply edit your phpMyAdmin's config-db.php file and setup the proper database password.
您最近是否更改了 MySQL 服务器 root 密码?如果答案是肯定的,那么这就是 phpMyAdmin 控制台中错误/警告的原因。要解决此问题,只需编辑 phpMyAdmin 的 config-db.php 文件并设置正确的数据库密码。
First answer is messing too much in my view and second answer did not work for me. So:
在我看来,第一个答案太混乱了,第二个答案对我不起作用。所以:
In Linux-based servers the file is usually located in:
在基于 Linux 的服务器中,该文件通常位于:
/etc/phpmyadmin/config-db.php
or:
或者:
/etc/phpMyAdmin/config-db.php
Example: (My File looked like this and I changed the user fromphpmyadminto admin, the username I created for maintaining my database through phpmyadmin, and put in the appropriate password.
示例:(我的文件看起来像这样,我将用户从 更改phpmyadmin为admin,这是我通过 phpmyadmin 创建的用于维护我的数据库的用户名,并输入了适当的密码。
$dbuser='phpmyadmin';
$dbpass=''; // set current password between quotes ' '
$basepath='';
$dbname='phpmyadmin';
$dbserver='';
$dbport='';
$dbtype='mysql';
学分:http: //tehnoblog.org/phpmyadmin-error-connection-for-controluser-as-defined-in-your-configuration-failed/
回答by Dominique H.
This worked for me with phpmyadmin under Ubuntu 16.04:
这对我在 Ubuntu 16.04 下的 phpmyadmin 有用:
I edited /etc/phpmyadmin/config.inc.php and changed the following 2 lines:
我编辑了 /etc/phpmyadmin/config.inc.php 并更改了以下两行:
$cfg['Servers'][$i]['controluser'] = 'root';
$cfg['Servers'][$i]['controlpass'] = 'thepasswordgiventoroot';
回答by Clive Wi
On Ubunbtu.
在 Ubuntu 上。
Ben's message is close but it's not the root password that is the problem, the problem I found was I had created a password for the phpmyadmin database when I installed it. This password is not carried into the installation on ubuntu so the variable $dbpass=''; in the database settings file is empty and not the password you set.
Ben 的消息很接近,但问题不是 root 密码,我发现的问题是我在安装 phpmyadmin 数据库时为它创建了密码。ubuntu 上的安装没有携带这个密码,所以变量 $dbpass=''; 在数据库设置文件中是空的,而不是你设置的密码。
- To check you have the right password at the command line login to mysql using the following command: mysql -u phpmyadmin -p try a blank password I found I got access denied, enter the command again using the password you set during installation. If it logs in you now know what the password is.
- Edit /etc/phpadmin/config-db.phpand change $dbpass='';to $dbpass='Your Password';and save the file.
- Edit /etc/dbconfig-common/phpmyadmin.confchange dbc_dbpass=''; to dbc_dbpass='Your Password';and save the file. Close your browser and reload you will now find the message has gone way.
- 要使用以下命令在命令行登录到 mysql 时检查您是否拥有正确的密码: mysql -u phpmyadmin -p 尝试使用空白密码我发现访问被拒绝,请使用您在安装期间设置的密码再次输入该命令。如果它登录,您现在知道密码是什么。
- 编辑/etc/phpadmin/config-db.php并更改$dbpass=''; 到$dbpass='您的密码'; 并保存文件。
- 编辑/etc/dbconfig-common/phpmyadmin.conf更改dbc_dbpass=''; 到dbc_dbpass='您的密码'; 并保存文件。关闭浏览器并重新加载,您现在会发现消息已消失。
回答by SoftwarerHelp
"For me to make it work again I just deleted the files
“为了让它再次工作,我只是删除了文件
ib_logfile0 and
ib_logfile0 和
ib_logfile1 .
ib_logfile1 。
from :
从 :
/Applications/MAMP/db/mysql56/ib_logfile0 "
/Applications/MAMP/db/mysql56/ib_logfile0"
On XAMPP its Xampp/xamppfiles/var/mysql
在 XAMPP 上,它的 Xampp/xamppfiles/var/mysql
Got this from PHP Warning: mysqli_connect(): (HY000/2002): Connection refused
从PHP 中得到这个警告:mysqli_connect(): (HY000/2002): Connection denied
回答by Royce
on ubuntu /etc/phpmyadmin/config-db.php
在 ubuntu 上 /etc/phpmyadmin/config-db.php
make sure the password matches your config.inc.php for the control user
确保密码与控制用户的 config.inc.php 匹配
also for the blowfish too short error
也因为河豚太短错误
edit /var/lib/phpmyadmin/blowfish_secret.inc.php and make the key longer
编辑 /var/lib/phpmyadmin/blowfish_secret.inc.php 并使密钥更长
回答by boaz
on ubuntu 18.04 in etc/phpmyadmin/config.inc.phpcomment all the block
在 ubuntu 18.04 上etc/phpmyadmin/config.inc.php评论所有块
Optional: User for advanced features
可选:高级功能的用户
回答by Tarik
The problem is that PhpMyAdmin control user (usually: pma) password does not match the mysql user: pma (same user) password.
问题是PhpMyAdmin控制用户(通常是:pma)密码与mysql用户:pma(同一用户)密码不匹配。
To fix it, 1. Set the password you want for user pma here:
要修复它, 1. 在此处为用户 pma 设置您想要的密码:
"C:\xampp\phpMyAdmin\config.inc.php"
$cfg['Servers'][$i]['controlpass'] = 'your_new_phpmyadmin_pass';
(should be like on line 32)
“C:\xampp\phpMyAdmin\config.inc.php”
$cfg['Servers'][$i]['controlpass'] = 'your_new_phpmyadmin_pass';
(应该像第 32 行)
Then go to mysql, login as root, go to: (I used phpmyadmin to go here)
然后去mysql,root登录,去:(我用phpmyadmin去这里)
Database: mysql ?Table: user
数据库:mysql ?表:用户
Edit the user: pma
编辑用户:pma
Select "Password" from the function list (left column) and set "your_new_phpmyadmin_pass" on the right column and hit go.
从功能列表(左栏)中选择“密码”,在右栏设置“your_new_phpmyadmin_pass”并点击go。
Restart mysql server.
重启mysql服务器。
Now the message should disappear.
现在消息应该消失了。

