PHP Error: Access denied for user etc...

aklug1138

New Member
Messages
1
Reaction score
0
Points
0
ok people...

i need help, desperately!

I'm working on a php page to insert data into a mysql database,
BUT
every time i click 'submit' on the page, it returns this error:
Error: Access denied for user '*********'@'localhost' (using password: YES)
(i removed username and replaced it with "*******" for obvious reasons...

here is the code I've typed up in my PHP page:

mysql_connect ("localhost", "*********", "********") or die ('Error: ' . mysql_error() ) ;
mysql_select_db ("user_info");

Ive checked countless times (about 20) to make sure that the username and password are correct and it is localhost.

Any suggestions?

Thanks,
Asher
 

descalzo

Grim Squeaker
Community Support
Messages
9,373
Reaction score
326
Points
83
If you are on x10, remember that the username is of the form cPanelusername_name (ie, igor_hump if your cPanel username is igor and the DB user is "hump" ) and that you have to add it to the database.

(actually, you can use cPanelusername and your cPanelpassword too).
 
Last edited:

essellar

Community Advocate
Community Support
Messages
3,295
Reaction score
227
Points
63
The username is probably the problem. It should be in the form "cPanelUserName_dbUserName" -- the database user name you created is only the last half. So if your cPanel user name is "ralph" and the database user you created is "cramdon", the complete username for accessing the database would be "ralph_cramdon".
 
Top