0

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

5
  • What relevant information is in the logs ?
    – user620588
    Mar 20, 2021 at 6:40
  • @user620588 I have updated the question with the error log contents
    – Aneeez
    Mar 20, 2021 at 7:11
  • You should read the log yourself, it really does tell you what the problem is.
    – user620588
    Mar 20, 2021 at 8:41
  • @user620588 I did read the log. It says the keyring_file_data file file given is missing. But the file does exist and I've even changed the permissions but it didn't work. I commented that line and now it's working.
    – Aneeez
    Mar 20, 2021 at 8:47
  • Perhaps then you should learn some more about file permissions. In particular pay attention to the directory path permissions.
    – user620588
    Mar 20, 2021 at 14:26

0

You must log in to answer this question.

Browse other questions tagged .