DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 

(mysql.info) drop-user

Info Catalog (mysql.info) create-user (mysql.info) account-management-sql (mysql.info) grant
 
 13.5.1.2 `DROP USER' Syntax
 ...........................
 
      DROP USER USER [, USER] ...
 
 The `DROP USER' statement removes one or more MySQL accounts. To use
 it, you must have the global `CREATE USER' privilege or the `DELETE'
 privilege for the `mysql' database. Each account is named using the
 same format as for the `GRANT' statement; for example,
 `'jeffrey'@'localhost''. The user and host parts of the account name
 correspond to the `User' and `Host' column values of the `user' table
 row for the account.
 
 `DROP USER' as present in MySQL 5.0.0 removes only accounts that have
 no privileges. In MySQL 5.0.2, it was modified to remove account
 privileges as well. This means that the procedure for removing an
 account depends on your version of MySQL.
 
 As of MySQL 5.0.2, you can remove an account and its privileges as
 follows:
 
      DROP USER USER;
 
 The statement removes privilege rows for the account from all grant
 tables.
 
 In MySQL 5.0.0 and 5.0.1, `DROP USER' deletes only MySQL accounts that
 have no privileges. In these MySQL versions, it serves only to remove
 each account record from the `user' table. To remove a MySQL account
 completely (including all of its privileges), you should use the
 following procedure, performing these steps in the order shown:
 
   1. Use `SHOW GRANTS' to determine what privileges the account has. See
       show-grants.
 
   2. Use `REVOKE' to revoke the privileges displayed by `SHOW GRANTS'.
      This removes rows for the account from all the grant tables except
      the `user' table, and revokes any global privileges listed in the
      `user' table.  See  grant.
 
   3. Delete the account by using `DROP USER' to remove the `user' table
      record.
 
 _Important_: `DROP USER' does not automatically close any open user
 sessions. Rather, in the event that a user with an open session is
 dropped, the statement does not take effect until that user's session is
 closed. Once the session is closed, the user is dropped, and that
 user's next attempt to log in will fail. _This is by design_.
 
Info Catalog (mysql.info) create-user (mysql.info) account-management-sql (mysql.info) grant
automatically generated byinfo2html