sean14592 Posted October 15, 2008 Share Posted October 15, 2008 hi im getting the following error: Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'USERNAME'@'localhost' (using password: YES) in /home/USERNAME/public_html/DIRECTORY/DIRECTORY/reg_pro.php on line 181 Access denied for user 'USERNAME'@'localhost' (using password: YES) ok, Usually I would think, ok it means there login is not correct, but it was all working before I set them up as variables and include config.php. heres my code: re_pro.php // Make a MySQL Connection mysql_connect($host,$username,$password) or die(mysql_error()); mysql_select_db($database) or die(mysql_error()); config.php $host = ("localhost"); //Host for all databases $database = ("DATABASE"); //database containing all tables $username = ("USERNAME"); //username to access the database $password = ("PASSWORD"); //password for the above user Thanks in advance. Sean Quote Link to comment https://forums.phpfreaks.com/topic/128574-mysql-connect-problem/ Share on other sites More sharing options...
revraz Posted October 15, 2008 Share Posted October 15, 2008 Can really only be a couple things. The username is wrong or the password is wrong, Quote Link to comment https://forums.phpfreaks.com/topic/128574-mysql-connect-problem/#findComment-666328 Share on other sites More sharing options...
Maq Posted October 15, 2008 Share Posted October 15, 2008 Also, nothing to do with your problem but here's a better way to set up a class for your MySQL database connectivity: MySQL Class. Quote Link to comment https://forums.phpfreaks.com/topic/128574-mysql-connect-problem/#findComment-666329 Share on other sites More sharing options...
sean14592 Posted October 15, 2008 Author Share Posted October 15, 2008 Can really only be a couple things. The username is wrong or the password is wrong, nope, username and password are 100% correct, I even tried deleting and making a new user account, any more ideas? thanks sean Quote Link to comment https://forums.phpfreaks.com/topic/128574-mysql-connect-problem/#findComment-666334 Share on other sites More sharing options...
wildteen88 Posted October 15, 2008 Share Posted October 15, 2008 When creating a new MySQL user account make sure you are allowing connections from localhost Quote Link to comment https://forums.phpfreaks.com/topic/128574-mysql-connect-problem/#findComment-666343 Share on other sites More sharing options...
sean14592 Posted October 15, 2008 Author Share Posted October 15, 2008 yep, im allowing them access to the database Quote Link to comment https://forums.phpfreaks.com/topic/128574-mysql-connect-problem/#findComment-666410 Share on other sites More sharing options...
PFMaBiSmAd Posted October 15, 2008 Share Posted October 15, 2008 You probably have a typo. Check the spelling and case of what you are doing. Quote Link to comment https://forums.phpfreaks.com/topic/128574-mysql-connect-problem/#findComment-666429 Share on other sites More sharing options...
Chicken Little Posted October 15, 2008 Share Posted October 15, 2008 Have you tried restarting the server? Quote Link to comment https://forums.phpfreaks.com/topic/128574-mysql-connect-problem/#findComment-666444 Share on other sites More sharing options...
PFMaBiSmAd Posted October 15, 2008 Share Posted October 15, 2008 Another possibility, since you switched to using variables, would be if you have some other code before your mysql_connect() statement that is using those same variable names and have overwritten the values. Posting your whole actual code would help someone to help you without playing a game of 20 guesses first. Quote Link to comment https://forums.phpfreaks.com/topic/128574-mysql-connect-problem/#findComment-666456 Share on other sites More sharing options...
Lee-Bartlett Posted October 15, 2008 Share Posted October 15, 2008 Is db connection case sensitive? if so might be that. Quote Link to comment https://forums.phpfreaks.com/topic/128574-mysql-connect-problem/#findComment-666469 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.