LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 07-20-2013, 12:48 AM   #1
tompa
LQ Newbie
 
Registered: Jul 2013
Posts: 6

Rep: Reputation: Disabled
I cant connect to the database, i need to set user privileges


I getting error on the site that i cant connect to the database ''Database connect failed''

My hosting provider already told me i have to set the privileges to user to the database and domain i think.

I have Debian and php 5.3.42. I using Fugo to connect to my VPS.

Any one can help me. Please explain very easy. I can manage to fix i it is easy.

Here is the error i get:

Database returned error "1142: DELETE command denied to user 'Example_user'@'localhost' for table 'user_properties' (localhost)".

Last edited by tompa; 07-20-2013 at 02:13 AM.
 
Old 07-20-2013, 03:55 AM   #2
j-ray
Senior Member
 
Registered: Jan 2002
Location: germany
Distribution: ubuntu, mint, suse
Posts: 1,551

Rep: Reputation: 139Reputation: 139
Welcome to LQ tompa!

Do you have ssh access to the machine where the database is running? What database is it? MySQl? The SQL statement to grant the delete right to user@localhost would be for MySQL

GRANT delete on DATABASENAME.* to 'Example_user'@'localhost' identified by 'SOMEPASSWORD'

In general you should provide us with more specific info.

Cheers
j
 
Old 07-20-2013, 04:02 AM   #3
tompa
LQ Newbie
 
Registered: Jul 2013
Posts: 6

Original Poster
Rep: Reputation: Disabled
Yes i have full access to root and to MySQL.

I have an VPS and full root access.

I have Apache2 with Debian i think

I using mac and my Terminal to access to root. I already made many changes to the server like install Xcache and PHP admin and so on. But this one i can't figure out. My hosting only reply with bad answer that they don't do that for me.

I have 2 domain and one subdomain. If i create an database and make an install and after the install are finish i get error to open the front page or admin because i get the error on the header that say user is denied.

Database returned error "1142: DELETE command denied to user 'Example_user'@'localhost' for table 'user_properties' (localhost)".

If i only now how so can i sure make it my self. But it have to simple step by step.

Last edited by tompa; 07-20-2013 at 04:07 AM.
 
Old 07-20-2013, 04:32 AM   #4
tompa
LQ Newbie
 
Registered: Jul 2013
Posts: 6

Original Poster
Rep: Reputation: Disabled
Ok! The hosting send me this! But not more.

Login into the server > enter mysql command
Once login into mysql execute the below commands.
1. use mysql;
2. Execute the query \"select * from db where Db like \"databasename\";
3. Once you find that certain priveleges are not assigned, you can assign them using the below sql command
GRANT DELETE ON <database name>.* TO <database_user>@\'localhost\';
FLUSH PRIVILEGES;

Ok so i did this!

First i connect to my server and execute this.

mysql;

Ok i get messages that im in. Then i did this

\"select * from db where Db like \"my_database_name_here\";

But now i get error SQL syntax

What do i wrong here?

I
 
Old 07-20-2013, 04:53 AM   #5
tompa
LQ Newbie
 
Registered: Jul 2013
Posts: 6

Original Poster
Rep: Reputation: Disabled
I did try now to set up a Mediawiki on my site and i get error when i trying to create a database


''Setting up database... failed''

Could not create database file /var/www/data/my_database_name.sqlite.
 
Old 07-20-2013, 05:16 AM   #6
j-ray
Senior Member
 
Registered: Jan 2002
Location: germany
Distribution: ubuntu, mint, suse
Posts: 1,551

Rep: Reputation: 139Reputation: 139
Is there a directory /var/www/data on your server? If not create it
sudo mkdir /var/www/data
then change the owner of the directory to the web user
sudo chown wwwrun:www /var/www/data
 
Old 07-20-2013, 05:28 AM   #7
Sydney
Member
 
Registered: Mar 2012
Distribution: Scientific Linux
Posts: 147

Rep: Reputation: 36
What your hosting company is not telling you, rightfully so. A database engine is going to require you to do some work to prepare a database for use. You will need to create a database on the database engine, the MYSQL engine can contain more than one database and the MYSQL database on the MYSQL database engine among other things controls user rights and access to each database, so you will need a user defined in the user table in the MYSQL database in the MYSQL database engine that gives rights to do some action to the database you create. Many tutorials are on the internet for setting up a user and a database, as well as the MYSQL site has a ton of documentation.

For your specific error, j-ray said how to add the DELETE privilege to your user, and your hosting provider mentioned the important step of FLUSH PRIVILEGES;. Why do you need DELETE to connect to the database though? You should not. I would first check to make sure you are using some other user (like one you create) besides root to connect to the database with your script. Then check your PHP script for a proper connection string, make sure it dies if no connection is established.

Your post about sqlite is a different issue, probably related to the creators rights, but should not be included in this string of posts.

Last edited by Sydney; 07-20-2013 at 05:29 AM.
 
Old 07-20-2013, 05:29 AM   #8
tompa
LQ Newbie
 
Registered: Jul 2013
Posts: 6

Original Poster
Rep: Reputation: Disabled
Yes! Already have this directory /var/www/data

I have my other domains there to. But only one domain is working. The hosting did fix one for me. But now they don't do more they say. LoL

I also now tried to chmod the data to 755 but didn't help. I know i have to set owner privileges somewhere with the command they gave me but i can't figurer it how to do.

Any one? Please help.
 
Old 07-20-2013, 05:36 AM   #9
tompa
LQ Newbie
 
Registered: Jul 2013
Posts: 6

Original Poster
Rep: Reputation: Disabled
Ok i did add this in to my terminal by that did not do anything. Could not find command?

GRANT delete on My_database_name.* to 'My_usename_here'@'localhost' identified by 'My_password_here'
 
Old 07-20-2013, 05:43 AM   #10
Sydney
Member
 
Registered: Mar 2012
Distribution: Scientific Linux
Posts: 147

Rep: Reputation: 36
Code:
mysql -uroot -ppassword;
use mysql;
GRANT delete on My_database_name.* to 'My_usename_here'@'localhost' identified by 'My_password_here'
FLUSH PRIVILEGES;
password, My_database_name, My_usename, My_password_here are variables
 
Old 07-20-2013, 08:01 AM   #11
j-ray
Senior Member
 
Registered: Jan 2002
Location: germany
Distribution: ubuntu, mint, suse
Posts: 1,551

Rep: Reputation: 139Reputation: 139
If you chmod the data directory to 0755 still the web user can't write to it. You have to chmod 0777 /var/www/data

but as Sydney said this is a different topic
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Trying to set OS authentication to Database user thiyagusham Linux - Newbie 3 12-23-2012 10:16 PM
DBI connect failed : Access denied for user 'root'@'%' to database 'mysql' kwickcut Linux - Software 11 02-10-2012 03:26 PM
[SOLVED] MySQL: Can't GRANT privileges after restoring a database Chili.Willy Linux - Software 2 12-03-2009 10:21 PM
DBI Connect Failed:Access denied for user ''@'localhost' to database <database> error kaplan71 Linux - Software 3 06-05-2009 01:39 PM
super user privileges check for a normal user in bash script freeindy Programming 2 08-01-2008 07:08 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 01:48 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration