LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
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 01-22-2008, 06:13 AM   #1
helptonewbie
Member
 
Registered: Aug 2006
Location: England Somewhere
Distribution: Mandriva, PCLinuxOS, Karoshi, Suse, Redhat, Ubuntu
Posts: 518

Rep: Reputation: 39
MySQL remove grant priv's from a drop user?


Hi All,
I've dropped some users and database 'test' created on normal install of MySQL server 5.0.x

However as it says in the mysql doc that the grant priv's are not automatically removed is the best way to remove those priv's using the 'delete' syntax??

DELETE FROM mysql.db WHERE Db = 'test';

Is that the correct MySQL method, it doesn't seem overly clear if that is correct in the MySQL doc?

Cheers
 
Old 01-22-2008, 08:58 AM   #2
tronayne
Senior Member
 
Registered: Oct 2003
Location: Northeastern Michigan, where Carhartt is a Designer Label
Distribution: Slackware 32- & 64-bit Stable
Posts: 3,477

Rep: Reputation: 1020Reputation: 1020Reputation: 1020Reputation: 1020Reputation: 1020Reputation: 1020Reputation: 1020Reputation: 1020
Permissions are removed with revoke; delete removes rows from tables.
 
Old 01-22-2008, 09:40 AM   #3
helptonewbie
Member
 
Registered: Aug 2006
Location: England Somewhere
Distribution: Mandriva, PCLinuxOS, Karoshi, Suse, Redhat, Ubuntu
Posts: 518

Original Poster
Rep: Reputation: 39
Yes but couldn't revoke these permissions as in a:-
select * from mysql.db;

i can see the tables test and test\_%, automatically created tables by MySQL with no users associated to them, in which case i couldn't remove it even though there wasn't a database called test anymore as i drop'd it. I've now used 'delete' to remove those from the table as its not something i need to use. Therefore not allowing anonymous users, and already default tables to be on the server.
 
Old 01-22-2008, 01:54 PM   #4
tronayne
Senior Member
 
Registered: Oct 2003
Location: Northeastern Michigan, where Carhartt is a Designer Label
Distribution: Slackware 32- & 64-bit Stable
Posts: 3,477

Rep: Reputation: 1020Reputation: 1020Reputation: 1020Reputation: 1020Reputation: 1020Reputation: 1020Reputation: 1020Reputation: 1020
Once you have dropped the test data base, you're done; however, if you want to get rid of the rest of it:
Code:
mysql mysql
drop database if exists test;
delete from db where db = 'test';
delete from db where db = 'test\\\%';
^D
will do that for you.

While you're digging around in there, put a password on the root user (the MySQL root user, not the system root) if you haven't already done that; then the syntax will be
Code:
mysql --password=password mysql
or
mysql -p mysql
password: <enter it>
 
Old 01-23-2008, 02:49 PM   #5
helptonewbie
Member
 
Registered: Aug 2006
Location: England Somewhere
Distribution: Mandriva, PCLinuxOS, Karoshi, Suse, Redhat, Ubuntu
Posts: 518

Original Poster
Rep: Reputation: 39
cheers for that, i also used:
mysql's 'set password' and
delete from mysql.db where Db = test;

Thanks and regards
 
Old 01-23-2008, 07:11 PM   #6
tronayne
Senior Member
 
Registered: Oct 2003
Location: Northeastern Michigan, where Carhartt is a Designer Label
Distribution: Slackware 32- & 64-bit Stable
Posts: 3,477

Rep: Reputation: 1020Reputation: 1020Reputation: 1020Reputation: 1020Reputation: 1020Reputation: 1020Reputation: 1020Reputation: 1020
Bye the by... you may want to consider getting out of the habit of "...mysql.db..."

When you start MySQL, you can start "empty" or start with the name of the data base you want to use; e.g., an "empty" start is
Code:
mysql
and a "named" start is
Code:
mysql dbname
If you start empty, you select a data base to work with
Code:
mysql
> use dbname;
And, the less fiddling around you do with the mysql data base, the better (you can really mess things up if you manage to do something silly in that data base if you know what I mean -- been there, did that, don't wanna do dat again...).

Best of luck with it.
 
Old 01-24-2008, 12:05 PM   #7
helptonewbie
Member
 
Registered: Aug 2006
Location: England Somewhere
Distribution: Mandriva, PCLinuxOS, Karoshi, Suse, Redhat, Ubuntu
Posts: 518

Original Poster
Rep: Reputation: 39
Cheers, Totally noted and i've been there for other purposes with different things before. It is the way to learn, break it fix it don't do it again :-)

BUT HELL, NOT IN A LIVE ENVIRONMENT!!!!!!!!!
 
  


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
MySQL DROP user --- how to fhleung Linux - Software 1 08-15-2007 11:27 AM
MySQL: Grant user database creation rights Swakoo Linux - General 4 09-13-2006 07:34 AM
How can I give myself root priv's as a user? Mr. Hill Linux - Newbie 9 06-12-2005 03:19 PM
mysql drop revoke user from specific host ? RedHat123 Programming 0 04-21-2005 03:54 PM
Mysql User grant problems ubers0ldat Linux - Software 7 07-30-2003 01:33 AM


All times are GMT -5. The time now is 04:23 PM.

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