Documentation Home
MySQL Shell for VS Code


MySQL Shell for VS Code  /  SQL  /  Create User Accounts

6.1 Create User Accounts

Where you see user and password, substitute an appropriate user name and password.

Create a user account with all schema-level privilege

Press CTRL+C to copy
CREATE USER 'user'@'localhost' IDENTIFIED BY 'password';
Press CTRL+C to copy
GRANT ALL ON *.* TO 'user'@'localhost' WITH GRANT OPTION;

The account can be used to connect to the server only from the local host.

Create a user account with specific schema-level privileges to access the world schema

Press CTRL+C to copy
CREATE USER 'user'@'localhost' IDENTIFIED BY 'password';
Press CTRL+C to copy
GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,DROP ON world.* TO 'user'@'localhost' WITH GRANT OPTION;

Show grants enabled for the current user account

Press CTRL+C to copy
SHOW GRANTS;