dbTalk Databases Forums  

Delete DB and all users

comp.databases.mysql comp.databases.mysql


Discuss Delete DB and all users in the comp.databases.mysql forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Joe Hesse
 
Posts: n/a

Default Delete DB and all users - 04-27-2011 , 11:31 AM






Hi,
If I delete an MySQL database, it appears that users who have privileges
only for that database are still around. How can I remove them?
Thank you,
Joe

Reply With Quote
  #2  
Old   
Mr. B-o-B
 
Posts: n/a

Default Re: Delete DB and all users - 04-27-2011 , 08:57 PM






Joe Hesse cried from the depths of the abyss...

Quote:
Hi,
If I delete an MySQL database, it appears that users who have privileges
only for that database are still around. How can I remove them?
Thank you,
Joe

You will find what you seek in the mysql.user table.

Reply With Quote
  #3  
Old   
Jerry Stuckle
 
Posts: n/a

Default Re: Delete DB and all users - 04-27-2011 , 10:42 PM



On 4/27/2011 12:31 PM, Joe Hesse wrote:
Quote:
Hi,
If I delete an MySQL database, it appears that users who have privileges
only for that database are still around. How can I remove them?
Thank you,
Joe
No, deleting a database does not delete the users - although if this is
the only database they can access, there is nothing else they can do.

If you want to delete the users, you need to REVOKE privileges from the
associated users.

Although many DBADMINs don't bother because the rows don't take up much
space, and they may later want to GRANT privileges to the users to other
databases. However, if that isn't the case in your situation, just
REVOKE all privileges from the users.

You can DELETE them from the mysql.users table, but you must ensure they
have NO OTHER privileges first.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex (AT) attglobal (DOT) net
==================

Reply With Quote
  #4  
Old   
Álvaro G. Vicario
 
Posts: n/a

Default Re: Delete DB and all users - 04-28-2011 , 03:30 AM



El 27/04/2011 18:31, Joe Hesse escribió/wrote:
Quote:
If I delete an MySQL database, it appears that users who have privileges
only for that database are still around. How can I remove them?
Use your favourite MySQL client or issue a DROP USER statement:

http://dev.mysql.com/doc/refman/5.1/en/drop-user.html


--
-- http://alvaro.es - Álvaro G. Vicario - Burgos, Spain
-- Mi sitio sobre programación web: http://borrame.com
-- Mi web de humor satinado: http://www.demogracia.com
--

Reply With Quote
  #5  
Old   
Thomas 'PointedEars' Lahn
 
Posts: n/a

Default Re: Delete DB and all users - 04-29-2011 , 02:48 PM



Mr. B-o-B wrote:

Quote:
Joe Hesse cried from the depths of the abyss...
If I delete an MySQL database, it appears that users who have privileges
only for that database are still around. How can I remove them?

You will find what you seek in the mysql.user table.
The `mysql` database should never be manipulated manually, though. There
are commands like GRANT and REVOKE that should be used instead. It is
rather easy to find out what they are by RTFM or testing with a frontend
like phpMyAdmin.

In this instance,

REVOKE ALL PRIVILEGES ON `database`.* FROM 'johndoe'@'%';

assuming there had been a

GRANT … ON `database`.* TO 'johndoe'@'%';

after the database was created.

<http://dev.mysql.com/doc/refman/5.1/en/drop-database.html>
<http://dev.mysql.com/doc/refman/5.1/en/account-management-sql.html>

--
PointedEars

Bitte keine Kopien per E-Mail. / Please do not Cc: me.

Reply With Quote
Reply




Thread Tools
Display Modes

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

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



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.