You are viewing an older version of this section. View current production version.
GRANT
Create a user account with the specified privileges.
Syntax
GRANT priv_type [, priv_type [ ... ]] ON priv_level
TO user_or_role [, user_or_role [ ... ]]
[WITH GRANT OPTION]
[REQUIRE {SSL | NONE}]
priv_type:
ALL PRIVILEGES
| SELECT
| INSERT
| UPDATE
| DELETE
| CREATE
| DROP
| RELOAD
| PROCESS
| FILE READ
| FILE WRITE
| INDEX
| ALTER
| SHOW METADATA
| SUPER
| CREATE TEMPORARY TABLES
| LOCK TABLES
| REPLICATION
| 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
priv_level:
*
| *.*
| database.*
user_or_role:
user [, user]
| role
user:
'user_name'@'host_name' [IDENTIFIED BY 'password']
role:
ROLE 'role_name'
Arguments
priv_type: The privileges to grant the specified user.
priv_level: The resource on which to grant privileges.
user_or_role: One or more user attributes or a role attribute.
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.
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 PRIVILEGES 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 ROLE 'full_backups_role';
If you removed ROLE
from the example above, the GRANT
command would apply privileges to the user 'full_backup_role'@'%'
.
Related Topics