Skip to content

Instantly share code, notes, and snippets.

@alexrinass
Created May 7, 2011 18:56
Show Gist options
  • Save alexrinass/960734 to your computer and use it in GitHub Desktop.
Save alexrinass/960734 to your computer and use it in GitHub Desktop.
Create new restricted MySQL user
CREATE USER 'USER'@'localhost' IDENTIFIED BY 'PASSWORD';
INSERT INTO `db` (`Host`, `Db`, `User`, `Select_priv`, `Insert_priv`, `Update_priv`, `Delete_priv`, `Create_priv`, `Drop_priv`, `Grant_priv`, `References_priv`, `Index_priv`, `Alter_priv`, `Create_tmp_table_priv`, `Lock_tables_priv`, `Create_view_priv`, `Show_view_priv`, `Create_routine_priv`, `Alter_routine_priv`, `Execute_priv`) VALUES
('localhost', 'DATABASE', 'USER', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'N', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'N', 'N');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment