LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 02-17-2006, 06:17 PM   #1
JockVSJock
Senior Member
 
Registered: Jan 2004
Posts: 1,420
Blog Entries: 4

Rep: Reputation: 164Reputation: 164
Error with MySQL Grant Command for other users


Have MySQL up and runnin on my Slackware laptop, just using it to play around and have fun.

I have two users under MySQL, root and a regular user. I create a database as root and grant rights to the regular user to the database.


As root...
Code:
grant * on foo to regularuser@localhost;
When I login to MySQL as the regular user and say try to create or drop a table, I get the command denied output.

What am I doing wrong, or can only root drop/create tables?

thanks
 
Old 02-17-2006, 06:25 PM   #2
accessrichard
Member
 
Registered: Apr 2005
Distribution: Fedora Core (latest version)
Posts: 156

Rep: Reputation: 30
Did you flush privileges;
Code:
mysql>grant all on * to user@"localhost" identified by 'password' with grant option;
mysql>flush privileges;
mysql>quit;

Last edited by accessrichard; 02-17-2006 at 06:26 PM.
 
Old 02-17-2006, 07:28 PM   #3
gbonvehi
Senior Member
 
Registered: Jun 2004
Location: Argentina (SR, LP)
Distribution: Slackware
Posts: 3,145

Rep: Reputation: 53
It should be:
Code:
grant all on foo.* to regularuser@localhost;
 
Old 02-17-2006, 07:43 PM   #4
JockVSJock
Senior Member
 
Registered: Jan 2004
Posts: 1,420

Original Poster
Blog Entries: 4

Rep: Reputation: 164Reputation: 164
Quote:
Originally Posted by accessrichard
Did you flush privileges;
Code:
mysql>grant all on * to user@"localhost" identified by 'password' with grant option;
I don't believe these worked.

Quote:
Originally Posted by accessrichard
Code:
mysql>flush privileges;
mysql>quit;
Interesting, I didin't know about the flush command, is this a standard SQL command or something at a different level?
 
Old 02-17-2006, 07:45 PM   #5
JockVSJock
Senior Member
 
Registered: Jan 2004
Posts: 1,420

Original Poster
Blog Entries: 4

Rep: Reputation: 164Reputation: 164
Quote:
Originally Posted by gbonvehi
It should be:
Code:
grant all on foo.* to regularuser@localhost;
This gave the regular user the ability to create/drop or DDL commands.

But the regular user still can't create a database. Can only root do this?

thanks
 
Old 02-17-2006, 07:54 PM   #6
mdarby
Member
 
Registered: Nov 2004
Location: Columbus, Ohio
Distribution: Slackware-Current / Debian
Posts: 795

Rep: Reputation: 30
Have you reloaded MySQL?
 
Old 02-17-2006, 11:25 PM   #7
gbonvehi
Senior Member
 
Registered: Jun 2004
Location: Argentina (SR, LP)
Distribution: Slackware
Posts: 3,145

Rep: Reputation: 53
I've never tried, but I guess *.* would do the trick.
 
Old 02-18-2006, 04:32 PM   #8
accessrichard
Member
 
Registered: Apr 2005
Distribution: Fedora Core (latest version)
Posts: 156

Rep: Reputation: 30
From mysql.com
Quote:
The FLUSH statement clears or reloads various internal caches used by MySQL
The FLUSH PRIVILEGES command basically reloads accounts and passwords

When I create a user for myself I believe I use
GRANT ALL PRIVILEGES ON etc.
and I am able to create and delete databases.

MySQL howto add new users
http://dev.mysql.com/doc/refman/5.0/...ing-users.html


Thanks gbonvehi, I never actualy used the * I always specify a db name, it is good to know that that wont work for my future references.

Last edited by accessrichard; 02-18-2006 at 04:56 PM.
 
Old 02-19-2006, 02:57 PM   #9
JockVSJock
Senior Member
 
Registered: Jan 2004
Posts: 1,420

Original Poster
Blog Entries: 4

Rep: Reputation: 164Reputation: 164
Quote:
Originally Posted by mdarby
Have you reloaded MySQL?
What do you mean by 'reload?'

Stopping and starting the service?

thanks
 
Old 02-19-2006, 03:37 PM   #10
mdarby
Member
 
Registered: Nov 2004
Location: Columbus, Ohio
Distribution: Slackware-Current / Debian
Posts: 795

Rep: Reputation: 30
yep, restart the actual program.
 
  


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
Grant Privileges - MySQL Jannyno Linux - General 2 06-23-2012 02:00 AM
Why mysql GRANT does not work? robertoneto123 Linux - Software 2 01-23-2004 07:33 AM
how do i grant privilages to 'normal users' jogurt666 Linux - General 1 12-18-2003 01:39 PM
mysql grant issues Robin01 Linux - Newbie 1 10-29-2003 09:56 PM
MYSQL GRANT etc etc markopolox Programming 8 09-23-2003 02:58 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 06:55 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
Open Source Consulting | Domain Registration