Posted on Tuesday 29th January 2019
When working with a mysql database, you may need to add additional users for many reasons, following is a selection of commands to do this simply.
Change username password,database_name and table_name to the real values.
CREATE USER 'username'@'localhost' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON * . * TO 'newuser'@'localhost';
FLUSH PRIVILEGES;
GRANT type_of_permission ON database_name.table_name TO ‘username’@'localhost’;
REVOKE type_of_permission ON database_name.table_name FROM ‘username’@‘localhost’;
DROP USER ‘username’@‘localhost’;
SHOW GRANTS username;