Jump to content

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.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.