Jump to content

MYSQL connect problem


sean14592

Recommended Posts

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

Link to comment
https://forums.phpfreaks.com/topic/128574-mysql-connect-problem/
Share on other sites

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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.