2013-04-27 126 views
0

IM,但是当我尝试访问的网站我收到以下错误:PHP MySQL数据库 - 访问使用phpMyAdmin访问我的数据库否认

 MySQL said: Documentation 
#1045 - Access denied for user 'root'@'localhost' (using password: NO) 

代码连接PHP到SQL如下:

<?php 
/* 
* Generated configuration file 
* Generated by: phpMyAdmin 3.2.5 setup script by Piotr Przybylski <[email protected]> 
* Date: Sun, 21 Feb 2010 12:43:50 +0100 
*/ 

/* Servers configuration */ 
$i = 0; 

/* Server: localhost [1] */ 
$i++; 
$cfg['Servers'][$i]['verbose'] = 'localhost'; 
$cfg['Servers'][$i]['host'] = '127.0.0.1'; 
$cfg['Servers'][$i]['port'] = ''; 
$cfg['Servers'][$i]['socket'] = ''; 
$cfg['Servers'][$i]['connect_type'] = 'tcp'; 
$cfg['Servers'][$i]['extension'] = 'mysqli'; 
$cfg['Servers'][$i]['auth_type'] = 'config'; 
$cfg['Servers'][$i]['user'] = 'root'; 
$cfg['Servers'][$i]['password'] = ''; 
$cfg['Servers'][$i]['nopassword'] = true; 

$cfg['Servers'][$i]['AllowNoPassword']  = true; 
$cfg['Servers'][$i]['pmadb']   = 'phpmyadmin'; 
$cfg['Servers'][$i]['bookmarktable'] = 'pma_bookmark'; 
$cfg['Servers'][$i]['relation']   = 'pma_relation'; 
$cfg['Servers'][$i]['table_info']  = 'pma_table_info'; 
$cfg['Servers'][$i]['table_coords']  = 'pma_table_coords'; 
$cfg['Servers'][$i]['pdf_pages']  = 'pma_pdf_pages'; 
$cfg['Servers'][$i]['column_info']  = 'pma_column_info'; 
$cfg['Servers'][$i]['history']   = 'pma_history'; 
$cfg['Servers'][$i]['designer_coords'] = 'pma_designer_coords'; 
$cfg['Servers'][$i]['tracking']   = 'pma_tracking'; 




/* End of servers configuration */ 

$cfg['blowfish_secret'] = 'noFb57s3pq83MQVUDh9D2YLve1r8kUL2Bs27q32uBekGEzD33iTYs757G2nMt7n8'; 
$cfg['DefaultLang'] = 'en-utf-8'; 
$cfg['ServerDefault'] = 1; 
$cfg['UploadDir'] = './tmp/'; 
$cfg['SaveDir'] = './tmp/'; 
$cfg['CheckConfigurationPermissions'] = false; 
$cfg['AllowUserDropDatabase'] = true; 


$cfg['MySQLManualBase'] = 'http://dev.mysql.com/doc/refman/5.1/en'; 
$cfg['MySQLManualType'] = 'searchable'; 

?> 

连接是当地的一个也没有密码进入它,因此,我认为,数据库应认证和授权访问,原来它采用做工精细,但现在出于某种原因,我拒绝访问。 任何帮助表示赞赏。

+0

在我看来,它与你的主机有关。你创建了这个用户吗? – Don 2013-04-27 20:09:18

+2

可能是你需要改变你的根访问位置% - 它变得非常敏感本地主机vs 127.0.0.1 – aserwin 2013-04-27 20:11:09

回答

-1

您的应用程序使用root帐户不是个好主意。始终为您的应用使用不同的用户!每个应用至少有一个。

我敢打赌,MySQL阻止了root登录。

#1045 - Access denied for user 'root'@'localhost' (using password: NO) 

我担心的是“使用密码:否” - root没有密码?

尝试创建新用户,授予他对正在处理的数据库的权限并重试。

2

在这种情况下,密码或用户名不正确。尝试确认并尝试再次连接。 给定的脚本使用下列凭证:

用户名:根

密码:<无>

也许你错过了正确的密码

0

首先,如果你已经安装了另一个MySQL实例验证。它发生在我身上。

如果您的系统中只有一个MySQL,并且如果您使用的是WAMP之类的东西,请打开config.inc.php并查找密码。

+1

谢谢最终确实工作的家伙 – user2327649 2013-04-27 21:01:41

+1

标记答案作为解决方案,如果帮助。 – igr 2013-04-27 21:05:41

+0

问题是什么? – 2013-04-27 23:17:32