title: Cannot enable encryption via keyring-file
body: <p>Ok, i'm following official Mysql docs to enable encryption on a mysql database on docker:  </p>
  
  <ul>
  <li><a href="https://dev.mysql.com/doc/refman/8.0/en/keyring-file-plugin.html" rel="nofollow noreferrer">Using the keyring_file File-Based Plugin</a></li>
  <li><a href="https://dev.mysql.com/doc/refman/8.0/en/keyring-installation.html" rel="nofollow noreferrer">Keyring Plugin Installation</a></li>
  <li><a href="https://dev.mysql.com/doc/refman/8.0/en/keyring-system-variables.html#sysvar_keyring_file_data" rel="nofollow noreferrer">keyring_file_data</a></li>
  </ul>
  
  <p>So here's what i've done:</p>
  
  <ol>
  <li>added <code>early-plugin-load</code> and <code>keyring_file_data</code> to <code>/etc/mysql/my.cnf</code> (i used <code>echo stuff &gt;&gt; file</code> since mysql docker image has no text editor), so now it is:</li>
  </ol>
  
  <pre><code>[mysqld]
  pid-file        = /var/run/mysqld/mysqld.pid
  socket          = /var/run/mysqld/mysqld.sock
  datadir         = /var/lib/mysql
  secure-file-priv= NULL
  # Disabling symbolic-links is recommended to prevent assorted security risks
  symbolic-links=0
  
  # Custom config should go here
  !includedir /etc/mysql/conf.d/
  early-plugin-load=keyring_file.so
  keyring_file_data=/usr/local/mysql/mysql-keyring/keyring
  </code></pre>
  
  <ol>
  <li>created keyring file with</li>
  </ol>
  
  <pre class="lang-sh prettyprint-override"><code>cd /usr/local/mysql
  mkdir mysql-keyring
  chmod 750 mysql-keyring
  chown mysql mysql-keyring
  chgrp mysql mysql-keyring
  </code></pre>
  
  <ol start="2">
  <li>restarted container to restart mysql</li>
  <li>connected to mysql and checked plugin availability (whith no luck) with</li>
  </ol>
  
  <pre class="lang-sql prettyprint-override"><code>mysql&gt; SELECT PLUGIN_NAME, PLUGIN_STATUS
         FROM INFORMATION_SCHEMA.PLUGINS
         WHERE PLUGIN_NAME LIKE 'keyring%';
  </code></pre>
  
  <ol start="4">
  <li>Checked the logs for errors:</li>
  </ol>
  
  <pre><code>2020-03-15T12:30:08.669015Z 0 [ERROR] [MY-011370] [Server] Plugin keyring_file reported: 'File '/usr/local/mysql/mysql-keyring/keyring' not found (OS errno 20 - Not a directory)'
  2020-03-15T12:30:08.669036Z 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'
  2020-03-15T12:30:08.669053Z 0 [ERROR] [MY-010202] [Server] Plugin 'keyring_file' init function returned error.
  </code></pre>
  
  <p>So it look like that i correctly enabled the plugin, but something is wrong with the file.</p>
  
  <p>Am i missing some steps?</p>
  
  <h1>keyring file</h1>
  
  <pre><code>root@8c3670db35d4:/# ls -la /usr/local/mysql/mysql-keyring/
  total 8
  drwxr-s--- 2 mysql mysql 4096 Mar 15 12:34 .
  drwxr-sr-x 3 root  staff 4096 Mar 15 12:33 ..
  -rw-r----- 1 mysql mysql    0 Mar 15 12:34 keyring
  </code></pre>