I am trying to encrypt some tables in a mysql database. I found a way in Mysql documentation (https://dev.mysql.com/doc/refman/8.0/en/innodb-data-encryption.html)
I have added the following lines under [mysqld] in my.cnf file
early-plugin-load=keyring_file.so
keyring_file_data=/home/aneeez/keyring_my
keyring_file.so exists in /usr/lib/mysql/plugin. I have also created the file /home/aneeez/keyring_my
After restarting mysql, I executed following query, but got no results
SELECT PLUGIN_NAME, PLUGIN_STATUS
FROM INFORMATION_SCHEMA.PLUGINS
WHERE PLUGIN_NAME LIKE 'keyring%'
And when I execute the query, ALTER TABLE users ENCRYPTION = 'Y';
I'm getting the following error.
#3185 - Can't find master key from keyring, please check in the server log if a keyring plugin is loaded and initialized successfully. Open new phpMyAdmin window
What am I missing?
UPDATE: Mysql error log below
2021-03-20T05:40:26.836746Z 0 [ERROR] [MY-011370] [Server] Plugin keyring_file reported: 'File '/home/anees/keyring_my' not found (OS errno 13 - Permission denied)' 2021-03-20T05:40:26.836801Z 0 [ERROR] [MY-011355] [Server] Plugin keyring_file reported: 'keyring_file initialization failure. Please check if the keyring_file_data points to readable keyring file or keyring file can be created in the specified location. The keyring_file will stay unusable until correct path to the keyring file gets provided' 2021-03-20T05:40:26.836836Z 0 [ERROR] [MY-010202] [Server] Plugin 'keyring_file' init function returned error. 2021-03-20T05:40:26.839667Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started. 2021-03-20T05:40:27.605193Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended. 2021-03-20T05:40:27.743091Z 0 [System] [MY-011323] [Server] X Plugin ready for connections. Bind-address: '127.0.0.1' port: 33060, socket: /var/run/mysqld/mysqlx.sock 2021-03-20T05:40:27.852035Z 0 [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed. 2021-03-20T05:40:27.852667Z 0 [System] [MY-013602] [Server] Channel mysql_main configured to support TLS. Encrypted connections are now supported for this channel. 2021-03-20T05:40:27.896459Z 0 [System] [MY-010931] [Server] /usr/sbin/mysqld: ready for connections. Version: '8.0.23-0ubuntu0.20.04.1' socket: '/var/run/mysqld/mysqld.sock' port: 3306 (Ubuntu). 2021-03-20T05:47:53.332801Z 59 [ERROR] [MY-012661] [InnoDB] Encryption can't find master key, please check the keyring plugin is loaded. 2021-03-20T06:22:48.430044Z 71 [ERROR] [MY-012656] [InnoDB] Encryption can't find master key, please check the keyring plugin is loaded. ret=1 2021-03-20T07:07:54.878488Z 107 [ERROR] [MY-012661] [InnoDB] Encryption can't find master key, please check the keyring plugin is loaded.
It says "File '/home/anees/keyring_my' not found (OS errno 13 - Permission denied)" but the file exists