954,600 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Error:UPDATE command denied to user 'somethin_root'@'localhost' for table 'user'

I Can't upload imige as my database donot support update although i give all previliges to the user root.Whats the problem??
Please Any one help me.The same code work on local PC.
The link is:

http://csefriends.com/index.php?page=auth/change_image.php

The code is given below:

<?php 
$id=$_SESSION['userid'];
$name=$_POST['name'];
$fname=time();
$type= ".jpeg";
$fname = $fname.$type;
$uploaddir = 'upload/';
$uploadfile = $uploaddir . $fname;
if(move_uploaded_file($_FILES['file']['tmp_name'], $uploadfile)) {
    $success="Data Added Successfully";
} else{
    $success= "There was an error uploading the file, please try again!";
}

$q="UPDATE `friendsdb`.`user` SET `link` = '$uploadfile' WHERE `user`.`id` ='$id' LIMIT 1 ;";

if(mysql_query($q)) echo "Your image uploaded successfully.";
else echo mysql_error();


?>
<script language='javascript'>
alert('<?php echo $success; ?>');
</script> 
<html>
<head>

</head>
</html>
amanu092
Newbie Poster
15 posts since Sep 2010
Reputation Points: 10
Solved Threads: 0
 

You need to provide privileges to somethin_root (or whatever user you have created on your hosting) not the root. root user is not available on shared hosting environment.

mwasif
Posting Whiz
315 posts since Dec 2007
Reputation Points: 29
Solved Threads: 48
 

Thanks brother mwasif.
I provide all the previliges
to user somethin_root
but the problen doesnot solved.
I also tried for user somethin_admin
also for user somethin_aman
but the result is same.
what can i do now?

amanu092
Newbie Poster
15 posts since Sep 2010
Reputation Points: 10
Solved Threads: 0
 

Where are you facing this problem? On your local system or on a production server?

mwasif
Posting Whiz
315 posts since Dec 2007
Reputation Points: 29
Solved Threads: 48
 

Run the following query to show the user's current rights

SHOW GRANTS FOR 'somethin_root'@'localhost';
mwasif
Posting Whiz
315 posts since Dec 2007
Reputation Points: 29
Solved Threads: 48
 

Thanks a lot @brother mwasif.I solved my problem.
removing `friendsdb`. on line 15.
thanks a lot again.

amanu092
Newbie Poster
15 posts since Sep 2010
Reputation Points: 10
Solved Threads: 0
 

What was the problem?

mwasif
Posting Whiz
315 posts since Dec 2007
Reputation Points: 29
Solved Threads: 48
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You