You are viewing an older version of this section. View current production version.
CREATE USER
Create a new user account.
Syntax
CREATE USER user[@host] [IDENTIFIED BY 'password']
Arguments
user
The name of the user.
host
The host that the user can connect from. For example, specifying localhost
means the user account can be used only when connecting from the local host. If no host is explicitly specified, the %
wildcard will be used by , which allows the user to connect from any host.
password
An optional database connection password.
Remarks
The CREATE USER
command must be run by a user with administrative privileges on the database. Also, the new user does not have any privileges granted by default. Use GRANT to specify privileges for the new user.
This command is only available on Enterprise Edition.
Examples
The following example demonstrates how to add a new user and grant it the SELECT privilege on all tables in the mydb
database:
memsql> CREATE USER joe;
memsql> GRANT SELECT ON mydb.* TO 'joe'@'%';