woodsonoversoul Posted September 9, 2007 Share Posted September 9, 2007 Started working on a login system for a project and for some reason I'm getting an Access Denied - unable to connect error. I'll post the code but I feel like I'm probably just confused over variable naming or something. Anyway: ob_start(); $host="localhost"; // Host name $username="***"; // Mysql username $password=""; // Mysql password $db_name="spindex"; // Database name $tbl_name="users"; // Table name // Connect to server and select databse. mysql_connect("$host", "$username", "$password")or die("cannot connect"); mysql_select_db("$db_name")or die("cannot select DB"); $password is empty, as I'm working from a localhost and no password is set. Let me know if you guys see anything that might trip me up. Thanks! Link to comment https://forums.phpfreaks.com/topic/68540-solved-why-might-i-get-access-denied/ Share on other sites More sharing options...
TheFilmGod Posted September 9, 2007 Share Posted September 9, 2007 um... I got this errror if you are trying to access the homepage of the website and there is no default page like "index.php" or default.htm" listed in the root file. I also got it if I tried accessing a directory with the similar details. Hope that helps. Link to comment https://forums.phpfreaks.com/topic/68540-solved-why-might-i-get-access-denied/#findComment-344543 Share on other sites More sharing options...
woodsonoversoul Posted September 9, 2007 Author Share Posted September 9, 2007 The actual error message is: Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'dan'@'localhost' (using password: NO) in /var/www/spindex/checklogin.php on line 10 cannot connect Link to comment https://forums.phpfreaks.com/topic/68540-solved-why-might-i-get-access-denied/#findComment-344567 Share on other sites More sharing options...
TheFilmGod Posted September 9, 2007 Share Posted September 9, 2007 You have a problem with the mysql user privilieges table. You have to go into mysql and configure the root adminstrator. That should be YOU. Link to comment https://forums.phpfreaks.com/topic/68540-solved-why-might-i-get-access-denied/#findComment-344581 Share on other sites More sharing options...
woodsonoversoul Posted September 9, 2007 Author Share Posted September 9, 2007 It's just that I don't have this problem when any of my other pages connect to the dgb, and they all connect the same way... Link to comment https://forums.phpfreaks.com/topic/68540-solved-why-might-i-get-access-denied/#findComment-344591 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.