|
|
|
|
create schema schema_name authorization db_user; |
All access authorization of the new database is granted (= given) to the user db_user (i.e., he is the owner of the database)
|
create database database_name ; |
In MySQL, a database can only be created by the "root" user
The authorization (= access permission) is granted separately
CREATE USER 'userid'@'hostname' IDENTIFIED BY 'password' ; |
CREATE USER 'cheung'@'aruba.mathcs.emory.edu' IDENTIFIED BY '12345' ; |
User 'cheung' can only use MySQL from host aruba.mathcs.emory.edu.
CREATE USER 'cheung'@'%' IDENTIFIED BY '12345' ; |
User 'cheung' can only use MySQL from any (wildcard) host.
CREATE USER 'cs377'@'%' IDENTIFIED BY 'abc123'; |
GRANT permission ON database.table TO 'user'@'host' ; |
GRANT SELECT ON companyDB.* TO 'cs377'@'%'; |
Grants the SELECT permission to all tables in the companyDB database to user cs377 login from any host
GRANT ALL ON companyDB.* TO 'cs377'@'%'; |
Grants the all permission (select, delete, updata, create table, drop table, ....) to all tables in companyDB database to user cs377 login from any host