| 1 |
drop database if exists db; |
| 2 |
Warnings: |
| 3 |
Note 1008 Can't drop database 'db'; database doesn't exist |
| 4 |
create role r1; |
| 5 |
create user beep@'%'; |
| 6 |
create database db; |
| 7 |
create table db.t1 (i int); |
| 8 |
create table db.t2 (b int); |
| 9 |
grant select on db.* to r1; |
| 10 |
grant r1 to beep@'%'; |
| 11 |
connect con1,localhost,beep,,; |
| 12 |
show databases; |
| 13 |
Database |
| 14 |
information_schema |
| 15 |
show create database db; |
| 16 |
ERROR 42000: Access denied for user 'beep'@'localhost' to database 'db' |
| 17 |
select table_schema, table_name from information_schema.tables |
| 18 |
where table_schema = 'db' order by table_name; |
| 19 |
table_schema table_name |
| 20 |
set role r1; |
| 21 |
show databases; |
| 22 |
Database |
| 23 |
db |
| 24 |
information_schema |
| 25 |
show create database db; |
| 26 |
Database Create Database |
| 27 |
db CREATE DATABASE `db` /*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_uca1400_ai_ci */ |
| 28 |
select table_schema, table_name from information_schema.tables |
| 29 |
where table_schema = 'db' order by table_name; |
| 30 |
table_schema table_name |
| 31 |
db t1 |
| 32 |
db t2 |
| 33 |
connection default; |
| 34 |
create role r2; |
| 35 |
create user beep2@'%'; |
| 36 |
grant update on db.* to r2; |
| 37 |
grant r2 to beep2; |
| 38 |
connect con2,localhost,beep2,,; |
| 39 |
show databases; |
| 40 |
Database |
| 41 |
information_schema |
| 42 |
show create database db; |
| 43 |
ERROR 42000: Access denied for user 'beep2'@'localhost' to database 'db' |
| 44 |
select table_schema, table_name from information_schema.tables |
| 45 |
where table_schema = 'db' order by table_name; |
| 46 |
table_schema table_name |
| 47 |
set role r2; |
| 48 |
show databases; |
| 49 |
Database |
| 50 |
db |
| 51 |
information_schema |
| 52 |
show create database db; |
| 53 |
Database Create Database |
| 54 |
db CREATE DATABASE `db` /*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_uca1400_ai_ci */ |
| 55 |
select table_schema, table_name from information_schema.tables |
| 56 |
where table_schema = 'db' order by table_name; |
| 57 |
table_schema table_name |
| 58 |
db t1 |
| 59 |
db t2 |
| 60 |
connection default; |
| 61 |
drop database db; |
| 62 |
drop role r1; |
| 63 |
drop user beep; |
| 64 |
drop role r2; |
| 65 |
drop user beep2; |