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

CREATE USER 'user'@'localhost'
  IDENTIFIED BY 'password';
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

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

Show grants enabled for the current user account

SHOW GRANTS;