Pre-General Availability Draft: 2017-07-17
MySQL Keyring plugins support the following system variables. Use them to configure keyring plugin operation. These variables are unavailable unless the appropriate keyring plugin is installed (see Section 6.5.4.1, “Keyring Plugin Installation”).
-
Command-Line Format --keyring-file-data=file_nameSystem Variable Name keyring_file_dataVariable Scope Global Dynamic Variable Yes Permitted Values Type file name Default platform specificThe path name of the data file used for secure data storage by the
keyring_fileplugin. This variable is unavailable unless that plugin is installed. The file location should be in a directory considered for use only by thekeyring_fileplugin. For example, do not locate the file under the data directory.Keyring operations are transactional: The
keyring_fileplugin uses a backup file during write operations to ensure that it can roll back to the original file if an operation fails. The backup file has the same name as the value of thekeyring_file_datasystem variable with a suffix of.backup.Do not use the same
keyring_filedata file for multiple MySQL instances. Each instance should have its own unique data file.The default file name is
keyring, located in a directory that is platform specific and depends on the value of theINSTALL_LAYOUTCMake option, as shown in the following table. To specify the default directory for the file explicitly if you are building from source, use theINSTALL_MYSQLKEYRINGDIRCMake option.INSTALL_LAYOUTValueDefault keyring_file_dataValueDEB,RPM,SLES,SVR4/var/lib/mysql-keyring/keyringOtherwise keyring/keyringunder theCMAKE_INSTALL_PREFIXvalueAt plugin startup, if the value assigned to
keyring_file_dataspecifies a file that does not exist, thekeyring_fileplugin attempts to create it (as well as its parent directory, if necessary).If you create the directory manually, it should have a restrictive mode and be accessible only to the account used to run the MySQL server. For example, on Unix and Unix-like systems, to use
/usr/local/mysql/mysql-keyring/keyring, the following commands (executed asroot) create the directory and set its mode and ownership:cd /usr/local/mysql mkdir mysql-keyring chmod 750 mysql-keyring chown mysql mysql-keyring chgrp mysql mysql-keyringIf the
keyring_fileplugin cannot create or access the file, it writes an error message to the error log. If an attempted runtime assignment tokeyring_file_dataresults in an error, the variable value remains unchanged.ImportantOnce the
keyring_fileplugin has created thekeyring_fileplugin data file and started to use it, it is important not to remove the file. For example,InnoDBuses the file to store the master key used to decrypt the data in tables that useInnoDBtablespace encryption; see Section 15.7.10, “InnoDB Tablespace Encryption”. Loss of the file will cause data in such tables to become inaccessible. (It is permissible to rename or move the file, as long as you change the value ofkeyring_file_datato match.) It is recommended that you create a separate backup of thekeyringfile immediately after you create the first encrypted table and before and after master key rotation.