Common MariaDB Queries

The following queries can help with your MariaDB TDE installation:

Query

Description

SHOW DATABASES; Lists all MariaDB databases in the server.

CREATE DATABASE my_database;

Creates a new database.

USE my_database;

Specifies the database to use.

INSTALL SONAME 'entrust_key_management';

Installs the entrust_key_management plugin.

SHOW TABLES

Lists all tables inside a database.

CREATE TABLE table1 (i int)

Creates a table "table1" that contains one column "i" which is in format integer.

CREATE TABLE table1 (i int) ENGINE=InnoDB ENCRYPTED=YES;

Creates an encrypted table "table1" using the default storage engine InnoDB, with one column "i" which is in format integer. This table will use key ID 1 by default as no key ID was specified.

CREATE TABLE table1 (i int) ENGINE=InnoDB ENCRYPTED=YES ENCRYPTION_KEY_ID=2;

Creates the encrypted table described above using key ID 2.

CREATE TABLE table2 (i int);

ALTER TABLE table2 ENCRYPTED=YES encryption_key_id=2;

Creates the unencrypted table "table2" with one column "i" which is in format integer.

The ALTER command encrypts the table using key ID 2.

ALTER TABLE table4 ENCRYPTED=NO

Disables the encryption on table "table4".

SELECT * FROM information_schema.innodb_tablespaces_encryption G;

Displays the encryption table details.