2013-10-27 38 views
-1

我在Windows 7計算機(64位)上使用XAMMP,PHPMyAdmin,Notepad ++。PHP代碼(使用XAMPP)Config.php

我試圖做一個登錄頁面,我的網站,使用本教程: http://net.tutsplus.com/tutorials/php/create-a-signup-form-with-email-confirmation/

不過,我得到這個錯誤:

Warning: mysql_connect(): Access denied for user 'username'@'localhost' (using password: YES) in ...\XAMPP\htdocs\EP\inc\php\config.php on line 4 I couldn't connect to your database, please make sure your info is correct!

這是我的代碼:

//connect to the database 
mysql_connect('localhost', 'username', 'password') or die("I couldn't connect to your database, please make sure your info is correct!"); 
mysql_select_db('registration') or die("I couldn't find the database table ($table) make sure it's spelt right!"); 

我完全不知道用戶名和密碼應該是什麼意思,我不確定'localhost'是否應該是我的IP。

+0

我們需要看你的代碼,但是localhost對你的本地連接是可以的,請嘗試將你的用戶改爲「root」(不含引號),密碼爲空(或者「root」,如果空不工作) – Duver

回答

0

嘗試把這樣的數據:

mysql_connect ('localhost', 'root','') or die ("here you put whatever you want"); 

通常這是默認的訪問。