User

Create user

CREATE USER 'username'@'localhost' IDENTIFIED BY 'password'; -- '%' for all hosts

Permissions

Permission
Description

ALL PRIVILEGES

Grant all access

CREATE

Create databases

DROP

Delete databases

DELETE

Delete rows from table

INSERT

Insert rows into table

SELECT

Read/Query tables

UPDATE

Update rows in table

Grant permissions

GRANT ALL PRIVILEGES ON *.* TO 'username'@'localhost';
GRANT SElECT ON school.persons TO 'john'@'%';
GRANT ALL PRIVILEGES ON school.* TO 'john'@'%';

Show permissions

SHOW GRANTS FOR 'john'@'localhost';

Last updated

Was this helpful?