DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH
 

(mysql.info.gz) DROP USER

Info Catalog (mysql.info.gz) CREATE USER (mysql.info.gz) Account management SQL (mysql.info.gz) GRANT
 
 13.5.1.2 `DROP USER' Syntax
 ...........................
 
      DROP USER USER [, USER] ...
 
 The `DROP USER' statement deletes one or more MySQL accounts.  To use
 it, you must have the `GRANT OPTION' privilege for the `mysql'
 database.  Each account is named using the same format as for `GRANT'
 or `REVOKE'; 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 record for the account.
 
 `DROP USER' was added in MySQL 4.1.1 and originally removed only
 accounts that have no privileges.  In MySQL 5.0.2, it was modified to
 also remove account privileges.  This means that the procedure for
 removing an account depends on your version of MySQL.
 
 As of MySQL 5.0.2, remove an account and its privileges as follows:
 
      DROP USER USER;
 
 The statement removes privilege records for the account from all grant
 tables.
 
 From MySQL 4.1.1 to 5.0.1, `DROP USER' deletes only MySQL accounts that
 don't have any privileges.  It serves to remove each account record
 from the `user' table.  To remove a MySQL account, you should use the
 following procedure, performing the steps in the order shown:
 
   1. Use `SHOW GRANTS' to determine what privileges the account has.
       `SHOW GRANTS' SHOW GRANTS.
 
   2. Use `REVOKE' to revoke the privileges displayed by `SHOW GRANTS'.
      This removes records for the account from all the grant tables
      except the `user' table, and revokes any global privileges listed
      in the `user' table.   `GRANT' GRANT.
 
   3. Delete the account by using `DROP USER' to remove the `user' table
      record.
 
 Before MySQL 4.1.1, `DROP USER' is not available.  You should first
 revoke the account privileges as just described. Then delete the `user'
 table record and flush the grant tables like this:
 
      mysql> DELETE FROM mysql.user
          -> WHERE User='USER_NAME' and Host='HOST_NAME';
      mysql> FLUSH PRIVILEGES;
 
Info Catalog (mysql.info.gz) CREATE USER (mysql.info.gz) Account management SQL (mysql.info.gz) GRANT
automatically generated byinfo2html