GRANT

Create a user account with the specified privileges.

Syntax

GRANT priv_type [, priv_type] ... ON priv_level
    TO user_specification [, user_specification] ...
    WITH GRANT OPTION
    [REQUIRE {SSL | NONE}]

user_specification:
    user
    [
        IDENTIFIED BY [PASSWORD] 'password'
    ]

priv_level:
    *
  | *.*
  | database.*

priv_type:
	  SELECT
	| INSERT
	| UPDATE
	| DELETE
	| CREATE
	| DROP
	| RELOAD
	| PROCESS
	| FILE READ
	| FILE WRITE
	| GRANT OPTION
	| INDEX
	| ALTER
	| SHOW METADATA
	| SUPER
	| CREATE TEMPORARY TABLES
	| LOCK TABLES
	| REPLICATION SLAVE
	| CREATE VIEW
	| SHOW VIEW
	| CREATE USER
	| CLUSTER
	| ALTER VIEW
	| DROP VIEW
	| BACKUP
	| CREATE DATABASE
	| DROP DATABASE
	| CREATE PIPELINE
	| DROP PIPELINE
	| ALTER PIPELINE
	| START PIPELINE
	| SHOW PIPELINE

Arguments

user_specification: One or more user attributes.

priv_level: The resource on which to grant privileges.

priv_type: The privileges to grant the specified user.

Remarks

The GRANT command creates a new user if the specified username does not exist.

This command can be run on any MemSQL node. For more information, see the Node Requirements for MemSQL Commands.

Info

MemSQL Developer Edition only allows the creation of new users with root permissions.

Examples

The following example demonstrates how to grant privileges to the existing memsql_admin user:

memsql> GRANT ALL ON *.* TO 'memsql_admin'@'%' IDENTIFIED BY 'password' WITH GRANT OPTION;

The following example demonstrates how to grant the specified privileges to all databases to the full_backups_role role.

memsql> GRANT BACKUP, RELOAD ON *.* TO 'full_backups_role';

Related Topics

Was this article useful?