2012-11-13 261 views
8

我们在运行IIS 7.0的Windows计算机上安装了PHPMyAdmin。
我们可以使用命令行连接到MySQL,但我们无法使用PHPMyAdmin进行连接。
显示的错误是:Error #1045 Cannot log in to the MySQL server.
有人能请帮忙吗?错误#1045 - 无法登录到MySQL服务器 - > phpmyadmin

PHP Version 5.4.0
mysqlnd 5.0.10 - 20111026 - $Revision: 323634 $
phpMyAdmin-3.5.4-rc1-all-languages.7z

编辑:
我跟着下面没有成功链接,意思是我改变了密码,但phpMyAdmin的仍然有错误...
C.5.4.1.1. Resetting the Root Password: Windows Systems

还有像下面的线程没有帮助的堆栈:
Random error: #1045 Cannot log in to the MySQL server
但误差不是随机的 - >我一直有一个错误...

而且这是在phpMyAdmin文件夹config.inc.php文件:

<?php 
/* vim: set expandtab sw=4 ts=4 sts=4: */ 
/** 
* Config file view and save screen 
* 
* @package PhpMyAdmin-setup 
*/ 

if (!defined('PHPMYADMIN')) { 
    exit; 
} 

/** 
* Core libraries. 
*/ 
require_once './libraries/config/FormDisplay.class.php'; 
require_once './setup/lib/index.lib.php'; 
require_once './setup/lib/ConfigGenerator.class.php'; 

$config_readable = false; 
$config_writable = false; 
$config_exists = false; 
check_config_rw($config_readable, $config_writable, $config_exists); 
?> 
<h2><?php echo __('Configuration file') ?></h2> 
<?php display_form_top('config.php'); ?> 
<input type="hidden" name="eol" value="<?php echo htmlspecialchars(PMA_ifSetOr($_GET['eol'], 'unix')) ?>" /> 
<?php display_fieldset_top('', '', null, array('class' => 'simple')); ?> 
<tr> 
    <td> 
     <textarea cols="50" rows="20" name="textconfig" id="textconfig" spellcheck="false"><?php 
      echo htmlspecialchars(ConfigGenerator::getConfigFile()) 
     ?></textarea> 
    </td> 
</tr> 
<tr> 
    <td class="lastrow" style="text-align: left"> 
     <input type="submit" name="submit_download" value="<?php echo __('Download') ?>" class="green" /> 
     <input type="submit" name="submit_save" value="<?php echo __('Save') ?>"<?php if (!$config_writable) echo ' disabled="disabled"' ?> /> 
    </td> 
</tr> 
<?php 
display_fieldset_bottom_simple(); 
display_form_bottom(); 
?> 

其中这些代码的一部分,应该我改变?

谢谢。

回答

11

你需要以下您在您的文章提到的链接后做两其它产品:

一个已经变化了登录cridentials在phpMyAdmin的的config.inc.php

和第二地图,你需要重新启动你的web和mysql服务器..

PHP版本不here..you需要去的phpmyadmin安装目录,找到文件config.inc.php并在该文件把你的问题在行

$cfg['Servers'][$i]['user'] = 'root'; //mysql username here 
$cfg['Servers'][$i]['password'] = 'password'; //mysql password here 
+0

感谢您的回答一样 - >请你解释更多。我也认为phpmyadmin不支持PHP 5.4.0!我对吗?我应该改变PHP版本吗? – MoonLight

+0

我想你已经粘贴_phpmyadmin的index.php代码_ ..我已经更新了我的答案..请检查.. –

+0

感谢编辑 - >但我没有这些文件中的这些行 - >请参阅我的编辑再次。 – MoonLight

17

当前的MySQL密码在Linux中,我首先要到root的命令提示符下键入解决此问题:

# mysqladmin -u root password 'Secret Phrase Here' 

然后回去登录。每次都有作品!

+1

唯一一个解决了流浪者特权的问题! 4小时的搜索,添加评论,以防有人会在流浪的virtualbox中遇到与phpmyadmin安装相似的问题。 +它将在temporary.sh中工作 – versedi

4

如果您正在安装第一次那么请尝试用用户名和密码登录为根

1

当您更改在安全选项卡中的密码,有两个部分,一个在上一个在下。我认为这里常见的错误是,其他人尝试使用他们设置在“htaccess”下面的帐户登录,而他们应该登录到上面设置的密码。这就是我固定我的方式。

3

另一件事情在我做完所有事情后都没用 - 将config.inc.php中的“localhost”更改为127.0.0。1

0

如果您登录到“phpmyadmin”,然后退出登录,则可能无法尝试重新登录到同一个浏览器窗口。注销将浏览器看起来像这样的URL:

http://localhost/phpmyadmin/index.php?db=&token=354a350abed02588e4b59f44217826fd&old_usr=tester 

但对于我来说,在Mac OS X中的Safari浏览器,即URL只是不想工作。因此,我必须把清洁网址:

http://localhost/phpmyadmin 

不知道为什么,但截至今天,2015年10月20日,这就是我遇到。

0
sudo service mysql stop 

sudo mysqld --skip-grant-tables & 

mysql -u root mysql 

Change MYSECRET with your new root password 

UPDATE user SET Password=PASSWORD('MYSECRET') WHERE User='root'; FLUSH PRIVILEGES; exit; 
1

在MySQL 5.7在auth机构改变,文档可在官方手册here找到。

使用系统root用户(或sudo),可以通过CLI使用mysql'root'用户连接到mysql数据库。 所有其他用户也将工作。

然而,在phpmyadmin中,所有mysql用户都可以工作,但不是mysql的“root”用户。

这来自于这里:

$ mysql -Ne "select Host,User,plugin from mysql.user where user='root';" 
+-----------+------+-----------------------+ 
| localhost | root | auth_socket | 
| hostname | root | mysql_native_password | 
+-----------+------+-----------------------+ 

要 '修复' 这一安全功能,做到:

mysql -Ne "update mysql.user set plugin='mysql_native_password' where User='root' and Host='localhost'; flush privileges;" 

更多关于这也可以发现在手册中here

1

为Ubuntu用户,您的config.inc.php文件应该是这个

/* Authentication type */ 
$cfg['Servers'][$i]['auth_type'] = 'cookie'; 
$cfg['Servers'][$i]['user'] = 'username'; 
$cfg['Servers'][$i]['password'] = 'password'; 
/* Server parameters */ 
$cfg['Servers'][$i]['host'] = '127.0.0.1'; 
$cfg['Servers'][$i]['connect_type'] = 'tcp'; 
$cfg['Servers'][$i]['compress'] = false; 
$cfg['Servers'][$i]['AllowNoPassword'] = false; 
/** 
* phpMyAdmin configuration storage settings. 
*/ 
/* User used to manipulate with storage */ 
// $cfg['Servers'][$i]['controlhost'] = ''; 
// $cfg['Servers'][$i]['controlport'] = ''; 
// $cfg['Servers'][$i]['controluser'] = 'pma'; 
// $cfg['Servers'][$i]['controlpass'] = '';