我安装了Xampp(适用于Windows)。我很乐意使用它的所有功能。
然后我想更改MySql密码。我设置了一个随机生成的密码(rCZ4Xnz78zbLY2Vh)。然后PHPMyAdmin停止登录。它开始提供以下错误消息,从那时起它就一样了:
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'文件,其内容完全如下:
<?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。
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>
然后我通过命令行界面删除了密码:
我还从config.inc.php
文件中删除了密码。该文件中的相关行现在是:
$cfg['Servers'][$i]['controluser'] = 'root';
$cfg['Servers'][$i]['controlpass'] = '';
$cfg['Servers'][$i]['user'] = 'root';
$cfg['Servers'][$i]['password'] = '';
目前,这很奇怪,但我可以用我删除的密码连接,但我无法连接空密码:
C:\Users\hkBattousai>mysql.exe --user=root --password=rCZ4Xnz78zbLY2Vh // Connects
C:\Users\hkBattousai>mysql.exe --user=root --password= // Error given
我想为这个用户分配另一个随机密码,我想通过PHPMyAdmin访问我的数据库,就像我之前在新的Xampp安装中所做的那样。我该怎么办?我真的很困惑,我需要你的帮助。
就像config.inc.php
文件内容被忽略一样。我从模板文件config.sample.inc.php
复制了它并更改了其内容。它现在位于目录\Xampp\phpmyadmin\
。
版本:
Xampp : 3.1.0
MySQL : 5.5.27
PHP : 5.4.7
Apache : 2.4
Windows : 7 Ultimate x64 SP1
答案 0 :(得分:31)
您需要编辑phpMyAdmin目录中的config.inc文件(可能是C:\ xampp \ phpMyAdmin)并更改此行以匹配您在phpMyAdmin中为root输入的密码。
$ cfg ['Servers'] [$ i] ['password'] ='';
答案 1 :(得分:4)
如果您已经安装了WAMP,请转到[wamp root] \ apps [phpmyadmin安装]并找到文件config.inc.php。然后,您将以下条目更改为root用户的新密码。
$ cfg ['Servers'] [$ i] ['password']
保存文件,不要忘记重启WAMP服务。现在它应该作为魅力:)
答案 2 :(得分:0)
您需要指定实际密码。配置文件中未加密的密码
答案 3 :(得分:0)
这是Windows机器的解决方案:
当您将根密码更改为admin
时,现在访问 http://localhost/phpmyadmin 时,您会看到以下屏幕
打开 XAMPP_SETUP / phpMyAdmin / config.inc.php 文件
将config
更改为cookie
并添加密码。
并再次访问
http://localhost/phpmyadmin !!