This is a simple preparse MySQL Rewrite Query Plugin that replaces the query SELECT @@storage_engine
by SELECT @@default_storage_engine
. Works with MySQL 5.7.
mysql> SELECT @@storage_engine;
+--------------------------+
| @@default_storage_engine |
+--------------------------+
| InnoDB |
+--------------------------+
1 row in set, 1 warning (0.00 sec)
mysql> SHOW WARNINGS;
+-------+------+----------------------------------------------------------------------------------------------------------+
| Level | Code | Message |
+-------+------+----------------------------------------------------------------------------------------------------------+
| Note | 1105 | Query 'SELECT @@storage_engine' rewritten to 'SELECT @@default_storage_engine' by a query rewrite plugin |
+-------+------+----------------------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)
Some applications will try to query SELECT @@storage_engine;
in MySQL 5.7 and will receive the error ERROR 1193 (HY000): Unknown system variable 'storage_engine'
. This plugin will replace the query with SELECT @@default_storage_engine
preventing the error.
- Put the rewrite_status_storage_engine.so library in your mysql plugin directory (the directory named by the MySQL plugin_dir system variable)
- If you use Linux 64-bit, you can download the compiled library rewrite_status_storage_engine.so here
- If you want or need compile by yourself, put this project in plugin folder of mysql/mysql-server and compile (ex.
cmake; make
)
- Make sure the library has the right permissions:
chmod 755 rewrite_status_storage_engine.so
- Install the plugin in MySQL:
INSTALL PLUGIN rewrite_status_storage_engine SONAME 'rewrite_status_storage_engine.so';
- Check if plugin is installed and active:
mysql> SHOW PLUGINS\G
Name: rewrite_status_storage_engine
Status: ACTIVE
Type: AUDIT
Library: rewrite_status_storage_engine.so
License: GPL
After installation, just try it!
mysql> select @@version;
+-------------------------------------------+
| @@version |
+-------------------------------------------+
| 5.7.15-enterprise-commercial-advanced-log |
+-------------------------------------------+
1 row in set (0.00 sec)
mysql> SELECT @@storage_engine;
+--------------------------+
| @@default_storage_engine |
+--------------------------+
| InnoDB |
+--------------------------+
1 row in set, 1 warning (0.00 sec)
mysql> show warnings;
+-------+------+----------------------------------------------------------------------------------------------------------+
| Level | Code | Message |
+-------+------+----------------------------------------------------------------------------------------------------------+
| Note | 1105 | Query 'SELECT @@storage_engine' rewritten to 'SELECT @@default_storage_engine' by a query rewrite plugin |
+-------+------+----------------------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)
You can remove the plugin with:
mysql> UNINSTALL PLUGIN plugin 'rewrite_status_storage_engine';
Optionally remove the library:
rm rewrite_status_storage_engine.so
The code of this plugin was based on Oracle MySQL 5.7 rewrite_example plugin.