MySQL Tips
Login | Register RSS
08/05/2011 - MySQL 

MySQL Tips

Use this command to create a new username, with a password, but no grant permissions.

CREATE USER 'username'@'localhost' IDENTIFIED BY 'password';

Use this command to remove a username.

DROP USER 'username'@'localhost';

Use this command to grant permission to a specific user to read, add, edit & remove data from all tables of a given database. You can use '*.*', instead of 'database.*', if you want to revoke from all databases at one time. 

GRANT SELECT, INSERT, UPDATE, DELETE ON database.* TO 'username'@'localhost';
FLUSH PRIVILEGES;

Use this command to revoke the grant permission of a specific user to read, add, edit & remove data from all tables of a given database. You can use '*.*', instead of 'database.*', if you want to revoke from all databases at one time.

REVOKE SELECT, INSERT, UPDATE, DELETE ON database.* TO 'username'@'localhost';
FLUSH PRIVILEGES;


If you like this site or any of its content, please help promote it. Use the social media buttons below to help spread the word. Don't forget to post in the comments section.

  Print   Email