Difference between revisions of "Create a new user"

From SQLZOO
Jump to: navigation, search
(One intermediate revision by one user not shown)
Line 1: Line 1:
{{Users ref}}
 
 
Create a new user.
 
Create a new user.
 
<div class='ht'>
 
<div class='ht'>
Line 37: Line 36:
 
<source lang='sql' class='def e-mysql'>
 
<source lang='sql' class='def e-mysql'>
 
CREATE DATABASE scott;
 
CREATE DATABASE scott;
GRANT SELECT, INSERT,UPDATE,DELETE,CREATE,DROP
+
GRANT SELECT, INSERT,UPDATE,DELETE,CREATE,DROP,ALTER
 
   ON scott.* TO scott@localhost
 
   ON scott.* TO scott@localhost
 
   IDENTIFIED BY 'tiger';
 
   IDENTIFIED BY 'tiger';
Line 64: Line 63:
 
<div class="ecomm e-mimer" style="display: none">An IDENT is a user. A DATABANK corresponds to a file where the data is actually stored. Users normally have a SCHEMA - this is created as the user is created. </div>
 
<div class="ecomm e-mimer" style="display: none">An IDENT is a user. A DATABANK corresponds to a file where the data is actually stored. Users normally have a SCHEMA - this is created as the user is created. </div>
 
</div>
 
</div>
 +
{{Users ref}}

Revision as of 18:04, 18 December 2012

Create a new user.

schema:gisq

Give the new user permission to connect and to create their own tables etc.

 
 
CREATE USER scott IDENTIFIED BY 'tiger'
USE operating system.
CREATE USER scott WITH password = 'tiger'
GRANT ALL ON DATABASE scott TO scott
GRANT access ON DATABASE gisq TO scott
CREATE USER scott IDENTIFIED BY 'tiger'
CREATE USER scott WITH PASSWORD 'tiger';
CREATE DATABASE scott;
GRANT ALL ON DATABASE scott TO scott;
CREATE USER scott IDENTIFIED BY tiger
  TEMPORARY TABLESPACE temp
  DEFAULT TABLESPACE users;
GRANT CONNECT TO scott;
GRANT RESOURCE TO scott
CREATE LOGIN scott 
    WITH PASSWORD = 'tiger';
CREATE DATABASE scottsdb;
USE scottsdb;
CREATE USER scott FOR LOGIN scott;
CREATE DATABASE scott;
GRANT SELECT, INSERT,UPDATE,DELETE,CREATE,DROP,ALTER
   ON scott.* TO scott@localhost
   IDENTIFIED BY 'tiger';
FLUSH PRIVILEGES;
CREATE IDENT scott AS USER USING 'tiger';
CREATE DATABANK userBank;
GRANT TABLE ON userBank TO scott;
CREATE USER scott IDENTIFIED BY 'tiger'
Personal tools
Namespaces

Variants
Actions
Reference
Toolbox
Google AdSense