Only tables created with the ENCRYPTED=YES parameter will be encrypted.

Use the following queries to encrypt the tables: 

  • Create the encrypted table: 

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

  • Create the encrypted table by providing the encryption key ID: 

    CREATE TABLE table2 (i int) ENGINE=InnoDB ENCRYPTION_KEY_ID=2;

  • Insert the data: 

    INSERT INTO your_table_name (column1, column2, column3)

    VALUES ('value1', 'value2', 'value3');

  • Retrieve data: 

    SELECT * FROM your_table_name;

  • Get encryption details about the tables: 

    SELECT * FROM information_schema.innodb_tablespaces_encryption G;