Create a new user

From SQLZOO
Revision as of 13:03, 17 July 2012 by Connor (talk | contribs) (Created page with "Create a new user. <div class='ht'> <div class=params>schema:gisq</div> <div> Give the new user permission to connect and to create their own tables etc. </div> <source lang=s...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

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;
--The foolowing doesn't work since 5.0
--INSERT INTO mysql.user (user, host, password)
--VALUES ('scott', 'localhost', PASSWORD('tiger'));

CREATE DATABASE scott;

GRANT SELECT, INSERT,UPDATE,DELETE,CREATE,DROP
   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'