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? Quote 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 (edited) What should I do? Use the correct username/password combination. Is the username the same as the database name when you connect with Dreamweaver? Edited October 27, 2013 by Barand Quote 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). Quote 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... Quote Link to comment https://forums.phpfreaks.com/topic/283339-mysql-connection-fail/#findComment-1456378 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.