| 1 |
SET GLOBAL innodb_encrypt_tables = ON; |
| 2 |
SET GLOBAL innodb_encryption_threads = 4; |
| 3 |
CREATE TABLE t1 (pk INT PRIMARY KEY AUTO_INCREMENT, c VARCHAR(256)) ENGINE=INNODB ENCRYPTED=NO ENCRYPTION_KEY_ID=4; |
| 4 |
Warnings: |
| 5 |
Warning 140 InnoDB: ENCRYPTED=NO implies ENCRYPTION_KEY_ID=1 |
| 6 |
DROP TABLE t1; |
| 7 |
set @save_global = @@GLOBAL.innodb_default_encryption_key_id; |
| 8 |
set innodb_default_encryption_key_id = 99; |
| 9 |
Warnings: |
| 10 |
Warning 1210 innodb_default_encryption_key=99 is not available |
| 11 |
set global innodb_default_encryption_key_id = 99; |
| 12 |
Warnings: |
| 13 |
Warning 1210 innodb_default_encryption_key=99 is not available |
| 14 |
set global innodb_default_encryption_key_id = @save_global; |
| 15 |
CREATE TABLE t1 (pk INT PRIMARY KEY AUTO_INCREMENT, c VARCHAR(256)) ENGINE=INNODB; |
| 16 |
ERROR HY000: Can't create table `test`.`t1` (errno: 140 "Wrong create options") |
| 17 |
SHOW WARNINGS; |
| 18 |
Level Code Message |
| 19 |
Warning 140 InnoDB: ENCRYPTION_KEY_ID 99 not available |
| 20 |
Error 1005 Can't create table `test`.`t1` (errno: 140 "Wrong create options") |
| 21 |
Warning 1030 Got error 140 "Wrong create options" from storage engine InnoDB |
| 22 |
CREATE TABLE t1 (pk INT PRIMARY KEY AUTO_INCREMENT, c VARCHAR(256)) ENGINE=INNODB ENCRYPTED=YES; |
| 23 |
ERROR HY000: Can't create table `test`.`t1` (errno: 140 "Wrong create options") |
| 24 |
SHOW WARNINGS; |
| 25 |
Level Code Message |
| 26 |
Warning 140 InnoDB: ENCRYPTION_KEY_ID 99 not available |
| 27 |
Error 1005 Can't create table `test`.`t1` (errno: 140 "Wrong create options") |
| 28 |
Warning 1030 Got error 140 "Wrong create options" from storage engine InnoDB |
| 29 |
set innodb_default_encryption_key_id = 4; |
| 30 |
CREATE TABLE t1 (pk INT PRIMARY KEY AUTO_INCREMENT, c VARCHAR(256)) ENGINE=INNODB ENCRYPTED=YES; |
| 31 |
SHOW CREATE TABLE t1; |
| 32 |
Table Create Table |
| 33 |
t1 CREATE TABLE `t1` ( |
| 34 |
`pk` int(11) NOT NULL AUTO_INCREMENT, |
| 35 |
`c` varchar(256) DEFAULT NULL, |
| 36 |
PRIMARY KEY (`pk`) |
| 37 |
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci `ENCRYPTED`=YES `ENCRYPTION_KEY_ID`=4 |
| 38 |
DROP TABLE t1; |
| 39 |
CREATE TABLE t1 (pk INT PRIMARY KEY AUTO_INCREMENT, c VARCHAR(256)) ENGINE=INNODB; |
| 40 |
SHOW CREATE TABLE t1; |
| 41 |
Table Create Table |
| 42 |
t1 CREATE TABLE `t1` ( |
| 43 |
`pk` int(11) NOT NULL AUTO_INCREMENT, |
| 44 |
`c` varchar(256) DEFAULT NULL, |
| 45 |
PRIMARY KEY (`pk`) |
| 46 |
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci `ENCRYPTION_KEY_ID`=4 |
| 47 |
CREATE TABLE t2 (pk INT PRIMARY KEY AUTO_INCREMENT, c VARCHAR(256)) ENGINE=INNODB ENCRYPTED=NO ENCRYPTION_KEY_ID=1; |
| 48 |
ALTER TABLE t1 ENCRYPTION_KEY_ID=99; |
| 49 |
ERROR HY000: Table storage engine 'InnoDB' does not support the create option 'ENCRYPTION_KEY_ID' |
| 50 |
SHOW WARNINGS; |
| 51 |
Level Code Message |
| 52 |
Warning 140 InnoDB: ENCRYPTION_KEY_ID 99 not available |
| 53 |
Error 1478 Table storage engine 'InnoDB' does not support the create option 'ENCRYPTION_KEY_ID' |
| 54 |
set innodb_default_encryption_key_id = 1; |
| 55 |
drop table t1,t2; |
| 56 |
SET GLOBAL innodb_encrypt_tables=OFF; |
| 57 |
CREATE TABLE t1 (a int not null primary key) engine=innodb; |
| 58 |
ALTER TABLE t1 ENCRYPTION_KEY_ID=4; |
| 59 |
SHOW CREATE TABLE t1; |
| 60 |
Table Create Table |
| 61 |
t1 CREATE TABLE `t1` ( |
| 62 |
`a` int(11) NOT NULL, |
| 63 |
PRIMARY KEY (`a`) |
| 64 |
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci `ENCRYPTION_KEY_ID`=4 |
| 65 |
DROP TABLE t1; |
| 66 |
CREATE TABLE t2 (a int not null primary key) engine=innodb; |
| 67 |
ALTER TABLE t2 ENCRYPTION_KEY_ID=4, ALGORITHM=COPY; |
| 68 |
SHOW WARNINGS; |
| 69 |
Level Code Message |
| 70 |
SHOW CREATE TABLE t2; |
| 71 |
Table Create Table |
| 72 |
t2 CREATE TABLE `t2` ( |
| 73 |
`a` int(11) NOT NULL, |
| 74 |
PRIMARY KEY (`a`) |
| 75 |
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci `ENCRYPTION_KEY_ID`=4 |
| 76 |
CREATE TABLE t3 (a int not null primary key) engine=innodb ENCRYPTION_KEY_ID=4; |
| 77 |
DROP TABLE t3; |
| 78 |
SET GLOBAL innodb_encrypt_tables='FORCE'; |
| 79 |
CREATE TABLE t1 (a int primary key) engine=innodb encrypted=no; |
| 80 |
ERROR HY000: Can't create table `test`.`t1` (errno: 140 "Wrong create options") |
| 81 |
SHOW WARNINGS; |
| 82 |
Level Code Message |
| 83 |
Warning 140 InnoDB: ENCRYPTED=NO cannot be used with innodb_encrypt_tables=FORCE |
| 84 |
Error 1005 Can't create table `test`.`t1` (errno: 140 "Wrong create options") |
| 85 |
Warning 1030 Got error 140 "Wrong create options" from storage engine InnoDB |
| 86 |
FLUSH TABLES; |
| 87 |
create table t1(f1 int not null, f2 int not null)engine=innodb encrypted=yes; |
| 88 |
insert into t1 values(1, 2), (2, 3), (4, 5), (5, 6), (7, 8); |
| 89 |
insert into t1 select * from t1; |
| 90 |
BEGIN; |
| 91 |
INSERT INTO t2 VALUES (1); |
| 92 |
connect con1, localhost, root; |
| 93 |
SET DEBUG_SYNC = 'row_log_table_apply2_before SIGNAL done WAIT_FOR ever'; |
| 94 |
alter table t1 force; |
| 95 |
connection default; |
| 96 |
SET DEBUG_SYNC = 'now WAIT_FOR done'; |
| 97 |
SET GLOBAL innodb_flush_log_at_trx_commit=1; |
| 98 |
COMMIT; |
| 99 |
disconnect con1; |
| 100 |
select * from t1; |
| 101 |
f1 f2 |
| 102 |
1 2 |
| 103 |
2 3 |
| 104 |
4 5 |
| 105 |
5 6 |
| 106 |
7 8 |
| 107 |
1 2 |
| 108 |
2 3 |
| 109 |
4 5 |
| 110 |
5 6 |
| 111 |
7 8 |
| 112 |
drop table t1,t2; |