Description:
Mysql server does not initialize and displays errors for keyring component initialization if the component keyring file lies in the data directory
How to repeat:
Release tarball used: mysql-8.0.30-linux-glibc2.12-x86_64.tar.xz
1. Create global manifest file(mysqld.my) in mysql bin directory.
{
"components": "file://component_keyring_file"
}
2. Create global configuration file, component_keyring_file.cnf in lib/plugin directory. Set the path of component_keyring_file in the mysql data directory.
{
"path": "/home/manish.chawla/MS_8_0_30/data/component_keyring_file",
"read_only": false
}
3. Initialize mysqld with encryption options
/home/manish.chawla/MS_8_0_30/bin/mysqld --no-defaults --initialize-insecure --basedir=/home/manish.chawla/MS_8_0_30 --datadir=/home/manish.chawla/MS_8_0_30/data --server-id=100 --log-bin=binlog --innodb-undo-log-encrypt --innodb-redo-log-encrypt --binlog-encryption --binlog-rotate-encryption-master-key-at-startup --default-table-encryption=ON --log-replica-updates --gtid-mode=ON --enforce-gtid-consistency --binlog-format=row --source_verify_checksum=ON --binlog_checksum=CRC32
4. The server displays the following errors:
2022-08-19T09:42:14.812073Z 0 [ERROR] [MY-013714] [Server] Component component_keyring_file reported: 'The component is not initialized properly. Make sure that configuration is proper and use ALTER INSTANCE RELOAD KEYRING to reinitialize the component.'
2022-08-19T09:42:14.812288Z 0 [System] [MY-013169] [Server] /home/manish.chawla/MS_8_0_30/bin/mysqld (mysqld 8.0.30) initializing of server in progress as process 5595
2022-08-19T09:42:14.827553Z 0 [ERROR] [MY-012676] [InnoDB] Check keyring fail, please check the keyring is loaded.
2022-08-19T09:42:14.827580Z 0 [ERROR] [MY-010202] [Server] Plugin 'InnoDB' init function returned error.
2022-08-19T09:42:14.827590Z 0 [ERROR] [MY-010734] [Server] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
2022-08-19T09:42:14.827601Z 0 [ERROR] [MY-010168] [Server] Failed to initialize builtin plugins.
2022-08-19T09:42:14.827612Z 0 [ERROR] [MY-013455] [Server] The newly created data directory /home/manish.chawla/MS_8_0_30/data/ by --initialize is unusable. You can remove it.
2022-08-19T09:42:14.827621Z 0 [ERROR] [MY-010119] [Server] Aborting
Note: The issue is reproducible in 8.0.29 version also. This issue is not there in 8.0.28 version.
Suggested fix:
Mysql server should be able to initialize, when the component keyring file is in the data directory. If there is any restriction, then it can be added in the documentation.