tkc Posted October 27, 2013 Share Posted October 27, 2013 Hi Guys, I'm a beginner of PHP and MySQL. I got problem when trying to run a PHP file, result as shown below Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'YOURDATABASE'@'localhost' (using password: YES) in C:\xampp\htdocs\TT\dbconnect.php on line 2can not connect:Access denied for user 'YOURDATABASE'@'localhost' (using password: YES) Below is mine SQL database connection: <? $conn=mysql_connect("localhost","YOURDATABASE","YOURPASSWORD") or die("can not connect:".mysql_error()); mysql_select_db("YOURDATABASE",$conn) or die("can not connect to database:".mysql_error());?> But I checked the MySQL connection in Dreamweaver, it was sucessful. What should I do? Link to comment https://forums.phpfreaks.com/topic/283339-mysql-connection-fail/ Share on other sites More sharing options...
Barand Posted October 27, 2013 Share Posted October 27, 2013 What should I do? Use the correct username/password combination. Is the username the same as the database name when you connect with Dreamweaver? Link to comment https://forums.phpfreaks.com/topic/283339-mysql-connection-fail/#findComment-1455700 Share on other sites More sharing options...
tkc Posted October 27, 2013 Author Share Posted October 27, 2013 Thanks for reply. Meaning to say i must use user name : YOURDATABASE password : YOURPASSWORD in Dreamweaver MySQL Connection? I tried, but still error, like below: "1045 access denied for user YOURDATABASE@localhost (using password: Yes). Link to comment https://forums.phpfreaks.com/topic/283339-mysql-connection-fail/#findComment-1455701 Share on other sites More sharing options...
mentalist Posted October 31, 2013 Share Posted October 31, 2013 user name : YOURDATABASE You need to use username not database name... Link to comment https://forums.phpfreaks.com/topic/283339-mysql-connection-fail/#findComment-1456378 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.