MYSQL error

Status
Not open for further replies.

WNWORLD

New Member
Messages
3
Reaction score
0
Points
0
Access denied for user 'username'@'localhost' to database 'dbname' Even though in my CPanel I have allowed the user to access to db! Help!
 

Dead-i

x10Hosting Support Ninja
Community Support
Messages
6,084
Reaction score
368
Points
83
Access denied for user 'username'@'localhost' to database 'dbname'

Your script (or whatever you are using to connect) is attempting to connect using 'username' to the database 'dbname'. You need to change the configuration to the correct username and database name that you created within your cPanel. :)

For example, my database username would be something like: deadix10_duser
 

WNWORLD

New Member
Messages
3
Reaction score
0
Points
0
Sorry I hid my db name and that info but look at my code : $con = mysql_connect("localhost","whatsn32_socks","PASSWORD HERE");
if (!$con)
{
error_log("failed to connect:" , 0);
error_log(mysql_error(), 0);
exit("success=false");
} else{
$lol = mysql_select_db("whatn32_social", $con);
if (!$lol){
error_log(mysql_error(), 0);
exit("success=false");
} else{ Error as displayed in original post but matching these variables
 

descalzo

Grim Squeaker
Community Support
Messages
9,373
Reaction score
326
Points
83
Drop the user from the database and then add it back making sure you check ALL PRIVILIGES

On further review:

$lol = mysql_select_db("whatn32_social", $con);


should be the same as your cPanel username (like in your db user). Missing an s
 
Last edited:
Status
Not open for further replies.
Top