MySQL Grants grant and revoke

Posted on Wed 18 August 2010 in misc

I'm not really a fan of MySQL but here is a simple problem I always forget the syntax for which is really a SQL issue.

An installation of MediaWiki has an update script which requires the DROP privilege on the database, so I wanted to add the DROP privilege, run the update script and revoke the DROP privilege again.

Here's how:

mysql> show grants for 'username'@'host';
mysql> grant drop on adatabase.\* to 'username'@'host';
mysql> revoke drop on adatabase.\* from 'username'@'host';

Job's a good-un!