MySQL: Is it safe to set `key_buffer_size` to 0 if the db doesn't have any MyISAM table? In our system, we don't use MyISAM - only InnoDB (and occasionally, MEMORY).

Is it safe to set key_buffer_size to 0? Or there are unexpected side effects? Based on the manual, it seems it's safe.
In the MySQL Docs for 5.5, 5.6, 5.7, and 8.0 the minimum value is 8.
If you set it to 0 in my.cnf and restart mysqld, it may go to 8 anyway.
Since key_buffer_size is dynamic, login to mysql and run
mysql&gt; SET GLOBAL key_buffeer_size = 0;
mysql&gt; SELECT @@global.key_buffer_size;

Whatever the value is, so be it. The storage engine layer will handle it.
Please note that MyISAM caches index pages only. It was probably simpler to make the default minimum a very low nonzero value of 8 (which is exactly a byte) rather than code logic to see if the key cache is enabled with enough RAM.
UPDATE 2019-06-10 13:16 EDT
root@vt-mysql:~# mysql
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 36
Server version: 5.6.33-0ubuntu0.14.04.1 (Ubuntu)

Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql&gt; select @@global.key_buffer_size;
+--------------------------+
| @@global.key_buffer_size |
+--------------------------+
|                 16777216 |
+--------------------------+
1 row in set (0.05 sec)

mysql&gt; set global key_buffer_size = 0;
ERROR 1438 (HY000): Cannot drop default keycache
mysql&gt; set global key_buffer_size = 8;
ERROR 1438 (HY000): Cannot drop default keycache
mysql&gt; select version();
+-------------------------+
| version()               |
+-------------------------+
| 5.6.33-0ubuntu0.14.04.1 |
+-------------------------+
1 row in set (0.05 sec)

mysql&gt;

The documentation is wrong: You cannot resize the global buffer dynamically.
I added key_buffer_size = 0 and restarted mysqld. It ricocheted back to 16M.
I added key_buffer_size = 8 and restarted mysqld. It ricocheted back to 16M.
root@vt-mysql:~# vi /etc/mysql/my.cnf
root@vt-mysql:~#
root@vt-mysql:~#
root@vt-mysql:~#
root@vt-mysql:~# grep key_buffer_size /etc/mysql/my.cnf
key_buffer_size = 0
root@vt-mysql:~# service mysql stop &amp;&amp; sleep 10 &amp;&amp; service mysql start
mysql stop/waiting
mysql start/running, process 1991
root@vt-mysql:~# mysql -ANe&quot;SELECT @@global.key_buffer_size&quot;
+----------+
| 16777216 |
+----------+
root@vt-mysql:~# vi /etc/mysql/my.cnf
root@vt-mysql:~# grep key_buffer_size /etc/mysql/my.cnf
key_buffer_size = 8
root@vt-mysql:~# service mysql stop &amp;&amp; sleep 10 &amp;&amp; service mysql start
mysql stop/waiting
mysql start/running, process 2112
root@vt-mysql:~# mysql -ANe&quot;SELECT @@global.key_buffer_size&quot;
+----------+
| 16777216 |
+----------+
root@vt-mysql:~# vi /etc/mysql/my.cnf
root@vt-mysql:~# grep key_buffer_size /etc/mysql/my.cnf
key_buffer_size = 2M
root@vt-mysql:~# service mysql stop &amp;&amp; sleep 10 &amp;&amp; service mysql start
mysql stop/waiting
mysql start/running, process 2234
root@vt-mysql:~# mysql -ANe&quot;SELECT @@global.key_buffer_size&quot;
+----------+
| 16777216 |
+----------+
root@vt-mysql:~#

I guess the only correct thing I said was : Whatever the value is, so be it. The storage engine layer will handle it.