PHPMyAdmin在root密码更改后不连接 [英] PHPMyAdmin doesn't connect after root password change
问题描述
我安装了Xampp(适用于Windows)。我很高兴地使用它的所有功能。
I installed Xampp (for Windows). I was happily using it with its all features.
然后我想更改MySql密码。我设置了一个随机生成的密码(rCZ4Xnz78zbLY2Vh)。然后PHPMyAdmin停止登录。它开始给出以下错误消息,从那以后是一样的:
Then I wanted to change MySql password. I set a randomly generated password (rCZ4Xnz78zbLY2Vh). Then PHPMyAdmin stopped logging in. It started to give the following error message, and it is the same ever since:
Error
MySQL said:
Cannot connect: invalid settings.
phpMyAdmin tried to connect to the MySQL server, and the server rejected the connection.
You should check the host, username and password in your configuration and make sure that
they correspond to the information given by the administrator of the MySQL server.
然后我编辑了PHPMyAdmin的`config.inc.php'文件,
Then I edited the `config.inc.php" file of PHPMyAdmin, and made its contents exactly as below:
<?php
/* Servers configuration */
$i = 1;
$cfg['Servers'][$i]['host'] = '127.0.0.1';
$cfg['Servers'][$i]['port'] = '3306';
$cfg['Servers'][$i]['ssl'] = FALSE;
$cfg['Servers'][$i]['connect_type'] = 'tcp';
$cfg['Servers'][$i]['extension'] = 'mysql';
$cfg['Servers'][$i]['compress'] = FALSE;
$cfg['Servers'][$i]['controluser'] = 'root';
$cfg['Servers'][$i]['controlpass'] = 'rCZ4Xnz78zbLY2Vh';
$cfg['Servers'][$i]['auth_type'] = 'config';
$cfg['Servers'][$i]['user'] = 'root';
$cfg['Servers'][$i]['password'] = 'rCZ4Xnz78zbLY2Vh';
$cfg['Servers'][$i]['nopassword'] = TRUE;
/* rajk - for blobstreaming */
$cfg['Servers'][$i]['bs_garbage_threshold'] = 50;
$cfg['Servers'][$i]['bs_repository_threshold'] = '32M';
$cfg['Servers'][$i]['bs_temp_blob_timeout'] = 600;
$cfg['Servers'][$i]['bs_temp_log_threshold'] = '32M';
/* Other settings */
$cfg['blowfish_secret'] = '';
$cfg['DefaultCharset'] = 'utf-8';
$cfg['UploadDir'] = '';
$cfg['SaveDir'] = '';
?>
但我可以通过命令行使用相同的密码连接到MySql servier。
But I was able to connect to the MySql servier via command line by the same password .
C:\Users\hkBattousai>mysql.exe --user=root --password=rCZ4Xnz78zbLY2Vh
mysql.exe: Unknown OS character set 'cp857'.
mysql.exe: Switching to the default character set 'latin1'.
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 21
Server version: 5.5.27 MySQL Community Server (GPL)
Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql>
然后我通过命令行界面删除了密码:
Then I removed the password via the command line interface:
我也从 config.inc.php
文件中删除密码。该文件中的相关行现在是:
I also removed password from the config.inc.php
file. The relevant lines in that file are now:
$cfg['Servers'][$i]['controluser'] = 'root';
$cfg['Servers'][$i]['controlpass'] = '';
$cfg['Servers'][$i]['user'] = 'root';
$cfg['Servers'][$i]['password'] = '';
目前,很奇怪,但是我可以用我删除的密码连接,空密码:
Currently, it is strange but, I can connect with the password I deleted, but I cannot connect with empty password:
C:\Users\hkBattousai>mysql.exe --user=root --password=rCZ4Xnz78zbLY2Vh // Connects
C:\Users\hkBattousai>mysql.exe --user=root --password= // Error given
我想为这个用户分配另一个随机密码,我想通过PHPMyAdmin访问我的数据库,就像我在之前的Xampp安装过程中做的那样。我该怎么办?我真的很困惑,我需要你的帮助。
I want to assign another random password to this user, and I want to access my database via PHPMyAdmin, as I did within the fresh Xampp installation before. What should I do? I'm really confused and I need your help.
它像 config.inc.php
文件内容被忽略。我从模板文件 config.sample.inc.php
复制它并更改了其内容。它现在位于 \Xampp\phpmyadmin\
目录中。
It is like the config.inc.php
file contents are ignored. I copied it from the template file config.sample.inc.php
and altered its contents. It is now located in the directory \Xampp\phpmyadmin\
.
版本:
Xampp : 3.1.0
MySQL : 5.5.27
PHP : 5.4.7
Apache : 2.4
Windows : 7 Ultimate x64 SP1
推荐答案
您需要编辑phpMyAdmin目录(可能是C:\ xampp\phpMyAdmin)中的config.inc文件,并更改此行以匹配您在phpMyAdmin中为root输入的密码。 / p>
You need to edit the config.inc file in the phpMyAdmin directory (probably C:\xampp\phpMyAdmin) and change this line to match the password you entered for root in phpMyAdmin.
$ cfg ['Servers'] [$ i] ['password'] ='';
$cfg['Servers'][$i]['password'] = ' ';
这篇关于PHPMyAdmin在root密码更改后不连接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!