Adds a new user for connecting to the database server.
CREATE USER 'name'@'host' IDENTIFIED BY 'password';
Use a different authentication plugin for compatibility with some applications.
CREATE USER 'name'@'host' IDENTIFIED WITH 'mysql_native_password' BY 'password';
Removes an existing user.
DROP USER 'name'@'host';
Changes a user's name or host, and maintains grants.
RENAME USER 'user'@'host' TO 'user'@'host';
Shows all of the existing users.
SELECT User,Host,plugin FROM mysql.user;
Changes the password for an existing user.
ALTER USER 'name'@'host' IDENTIFIED BY 'password';
Add permissions to an existing user.
GRANT ALL PRIVILEGES ON database.table TO 'name'@'host';
Individual permissions can also be specified.
GRANT SELECT, UPDATE, INSERT, DELETE ON database.table TO 'name'@'host';
Remove permissions from an existing user.
REVOKE ALL PRIVILEGES ON database.table FROM 'name'@'host';
Individual permissions can also be specified.
REVOKE SELECT, UPDATE, INSERT, DELETE on database.table from 'name'@'host';
Shows all of the permissions for an existing user.
SHOW GRANTS FOR 'name'@'host';