Page 1 of 1

mysql_connect() error

Posted: Thu Jun 01, 2006 9:37 am
by beckbapegeneral
someone please give some guidance

Code: Select all

<?php
	$conn = mysql_connect('localhost','root','password');
	if (!$conn)
	{
	  die('Could not connect: '.mysql_error());
	}
	mysql_select_db('ticket');
?>

Code: Select all

Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'root'@'localhost' (using password: YES) in C:\Program Files\xampp\htdocs\dbconn.php on line 2
Could not connect: Access denied for user 'root'@'localhost' (using password: YES)

Posted: Thu Jun 01, 2006 9:39 am
by feyd
there is no user root or that is not the password for it.

Posted: Thu Jun 01, 2006 9:40 am
by ambivalent
It would appear that you are supplying incorrect credentials to mysql_connect.


edit::typo

Posted: Thu Jun 01, 2006 9:41 am
by ok
Sometimes you need to add "@localhost" to the user name ("root@localhost").