Database
MySQL Enterprise TDE
Enable and test TDE in MySQL Workbench
7min
mysql workbench is a versatile visual tool for database design, sql development, and server administration it offers advanced data modeling, query building, and mysql specific features for easier management of mysql databases this section demonstrates the following tasks connect to your mysql server from mysql workbench use mysql workbench to create a new database table with transparent data encryption (tde) enabled this generates an aes 256 key on the {{ch}} that serves as the master encryption key for mysql tde insert example data into the table and list the contents to verify that the data is decrypted transparently confirm that you can successfully rotate the master encryption key stored on the {{ch}} connect to mysql server perform the following steps to connect to your mysql server instance using mysql workbench launch mysql workbench start the program on your computer to open the initial dashboard open database connection window on the mysql workbench dashboard, go to mysql connections and select the \[+] button input connection details in the setup new connection window, input the details of your mysql server connection option description or required configuration connection name a label for your reference connection method typically, select standard (tcp/ip) to connect to a standard mysql server other methods, such as tcp/ip over ssh or a local socket or pipes for local connections, are available hostname the ip address or domain name of the mysql server you're connecting to you can use localhost if your mysql server is on the same machine as your mysql workbench port the port number that the mysql server is listening on the default mysql port is 3306 username the username you use to authenticate with the mysql server password if your account requires a password, select \[ store in vault ] to enter and save your password test c onnection after you enter the preceding details, select \[ test connection ] to ensure that your settings are correct and that mysql workbench can reach the mysql server connect if the test succeeds, select \[ ok ] to close the window and save the connection then, you can double click on the saved connection to connect to your mysql server create a database table perform the following steps to create a new database table with tde enabled open a new sql tab to execute queries run the following query to create a new encrypted table called t1 in the world schema or database, which is a sample database that comes pre installed in mysql use world; create table t1 (column1 int) encryption='y'; alternatively, you can enable encryption for an existing table by using the following sql query alter table t1 encryption='y'; insert data into the table perform the following steps to insert example data into the table open a new sql tab to execute queries run the following query to insert example data into the t1 table use world; insert into t1 (column1) values (10), (20), (30); verify the data perform the following steps to verify that the data decrypts transparently open a new sql tab to execute queries run the following query to retrieve the data you inserted into the t1 table select from t1; this should return the unencrypted rows you just inserted from the user perspective, transparent data encryption (tde) use is truly transparent data is automatically decrypted when you select it, and you won't see any difference compared to unencrypted data tde is about securing data at rest—that is, the data files on disk are encrypted when data is read from disk into memory, the mysql server automatically decrypts it when data is written back to disk, it's automatically encrypted so, as a user, you won't see any difference between encrypted and unencrypted data when you're querying it the encryption doesn't affect the data itself; it just affects how it is stored on disk the purpose of tde is to protect data if someone gets unauthorized access to the raw database files on the disk rotate the key perform the following steps to rotate the tde master key open a new sql tab to execute queries run the following query to rotate the tde master key alter instance rotate innodb master key; verify the rotation by inserting some new data into your encrypted table and then retrieving it insert into t1 (column1) values (40); select from t1; if the insert and select operations succeed, mysql can use the new key to encrypt and decrypt data the key rotation process doesn't re encrypt existing data with the new key—it just uses the new key for new encryptions you must retain the old versions of the key as long as data that was encrypted with them exists view the mysql tde master keys you can view the keys mysql tde creates on the {{ch}} in the keys menu for the mysql enterprise tde service you deployed