mysql_connect(): Access denied for user

10-23-08, 07:19 PM
|
|
Newbie Coder
|
|
Join Date: Oct 2008
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
|
mysql_connect(): Access denied for user
Hi,
I just setup Apache, MySQL, and PHP using XAMPP and did several tests, some of them are passed such as PHP info test and date test, but It failed in this following test:
code: Load.php
Test Result:
Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'rlq'@'localhost' (using password: YES) in C:\xampp\htdocs\Load.php on line 2
Could not connect: Access denied for user 'rlq'@'localhost' (using password: YES)
I need your help to continue.
Thanks
Last edited by Nico; 10-24-08 at 03:09 AM.
Reason: Wrappers.
|

10-25-08, 03:29 PM
|
 |
Community VIP
|
|
Join Date: Oct 2003
Location: Chicago, IL
Posts: 2,167
Thanks: 3
Thanked 8 Times in 8 Posts
|
|
Here is an obvious question. Did you add this user and password to the MySQL database?
Pete
|

10-27-08, 11:34 AM
|
|
Newbie Coder
|
|
Join Date: Oct 2008
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
|
mysql_connect(): Access denied for user
Hi Pete,
I installed apache, php and mysql using Xampp. When install, there was no question about user name, password or ... any query. After installed, I tested phpinfo, then tested this database connection code.
However, your question to me is the answer. So can you tell me how to add the user and password to the MySQL database?
Thanks,
|

10-27-08, 11:40 AM
|
 |
Community Leader
|
|
Join Date: Sep 2005
Location: Spain
Posts: 8,074
Thanks: 11
Thanked 88 Times in 83 Posts
|
|
XAMPP's default user is "root", and there is no default password, so try leaving this in blank.
|

10-27-08, 12:00 PM
|
|
Newbie Coder
|
|
Join Date: Oct 2008
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
|
mysql_connect(): Access denied for user
hi Nico,
I just tried to modify this line of code
$con = mysql_connect("localhost","rlq","abc123");
to
$con = mysql_connect("localhost","","");
$con = mysql_connect("localhost","rlq","abc123");
and the result is
Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'ODBC'@'localhost' (using password: NO) in C:\xampp\htdocs\Load.php on line 2
Could not connect: Access denied for user 'ODBC'@'localhost' (using password: NO)
So what I did not correct?
thanks,
|

10-27-08, 12:02 PM
|
 |
Community Leader
|
|
Join Date: Sep 2005
Location: Spain
Posts: 8,074
Thanks: 11
Thanked 88 Times in 83 Posts
|
|
The user. It should be "root".
|

10-27-08, 12:07 PM
|
|
Newbie Coder
|
|
Join Date: Oct 2008
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
hi Nico,
I tried with
$con = mysql_connect("localhost","root");
and the result is
Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'root '@'localhost' (using password: NO) in C:\xampp\htdocs\Load.php on line 2
Could not connect: Access denied for user 'root '@'localhost' (using password: NO)
thanks,
|

10-27-08, 12:31 PM
|
 |
Community Leader
|
|
Join Date: Sep 2005
Location: Spain
Posts: 8,074
Thanks: 11
Thanked 88 Times in 83 Posts
|
|
Actually, try it this way:
|

10-27-08, 12:43 PM
|
|
Newbie Coder
|
|
Join Date: Oct 2008
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
OOPS, I had "root " instead of "root". Your first suggestion is work.
thanks,
|

10-27-08, 12:48 PM
|
|
Newbie Coder
|
|
Join Date: Oct 2008
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Peter, Nico,
I really appreciate your help. The first time I join the internet help group.
I am deeply impressed this group( can I say our group).
thanks
|
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
|
|
|
| Thread Tools |
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|