2016-07-13 127 views
-1

我正在使用WAMP服務器進行android註冊頁面開發。我得到這個錯誤:訪問被拒絕用戶'root'@'localhost'(使用密碼:是)

Access denied for user 'root'@'localhost' (using password: YES)

請幫我解決這個問題。

這裏是我的config.inc.php文件:

<?php 
/* vim: set expandtab sw=4 ts=4 sts=4: */ 
/** 
* phpMyAdmin sample configuration, you can use it as base for 
* manual configuration. For easier setup you can use setup/ 
* 
* All directives are explained in documentation in the doc/ folder 
* or at <http://docs.phpmyadmin.net/>. 
* 
* @package PhpMyAdmin 
*/ 

/* 
* This is needed for cookie based authentication to encrypt password in 
* cookie 
*/ 
$cfg['blowfish_secret'] = 'a8b7c6d'; /* YOU MUST FILL IN THIS FOR COOKIE AUTH! */ 

/* 
* Servers configuration 
*/ 
$i = 0; 

/* 
* First server 
*/ 
$i++; 
/* Authentication type */ 
$cfg['Servers'][$i]['verbose'] = 'mysql wampserver'; 
//$cfg['Servers'][$i]['auth_type'] = 'cookie'; 
$cfg['Servers'][$i]['auth_type'] = 'config'; 
$cfg['Servers'][$i]['user'] = 'root'; 
$cfg['Servers'][$i]['password'] = ''; 
/* Server parameters */ 
$cfg['Servers'][$i]['host'] = '127.0.0.1'; 
$cfg['Servers'][$i]['connect_type'] = 'tcp'; 
$cfg['Servers'][$i]['compress'] = false; 
/* Select mysql if your server does not have mysqli */ 
$cfg['Servers'][$i]['extension'] = 'mysqli'; 
$cfg['Servers'][$i]['AllowNoPassword'] = true; 



/* 
* phpMyAdmin configuration storage settings. 
*/ 

// No warning on pmadb tables 
$cfg['PmaNoRelation_DisableWarning'] = true; 


?> 

這裏是config.php文件:

<?php 

/** 
* Database config variables 
*/ 
define("DB_HOST", "localhost"); 
define("DB_USER", "root"); 
define("DB_PASSWORD", "root"); 
define("DB_DATABASE", "android_api"); 
?> 

這裏是我的確切問題: enter image description here

+0

你使用了錯誤的密碼。您在配置中將其指定爲空字符串,但顯然服務器在root帳戶上沒有「無密碼」。 –

+3

嘗試授予權限時可能出現[拒絕用戶'root'@'localhost'的訪問權限。如何授予權限?](http://stackoverflow.com/questions/8484722/access-denied-for-user-rootlocalhost-while-attempting-to-grant-privileges) – olibiaz

+0

@MarcB如果我輸入任何密碼字段我甚至可以打開php管理頁面整個頁面出現此錯誤,如果我這樣做 –

回答

1

除非你已經爲root用戶標識添加了密碼,然後默認情況下它不帶密碼出現。

所以只要把

define("DB_USER", "root"); 
define("DB_PASSWORD", ""); 

或只保留密碼字段中phpMyAdmin的空白,並擊中GO按鈕

回覆:您的評論:我使用phpMyAdmin

這時屏幕應該看起來像這樣

enter image description here

用戶名輸入root並保留password:場空

然後按下GO按鈕

+0

如果我這樣做,我甚至可以打開php管理頁面 –

+0

錯誤正在爲整個頁面,如果我dothat –

+0

謝謝@ chris85 – RiggsFolly

相關問題