# MySQL extensions This project contains an authentication plugin and functions to extend MySQL functionality. ## Compiling Install basic tools for compiling. ``` $ apt-get install build-essential devscripts dh-autoreconf ``` Install MySQL development libraries. ``` $ apt-get install libmysqld-dev ``` If MySQL development libraries are not available for your distribution or MySQL version you can obtain MySQL server source code from apt sources repository or from MySQL page. ``` $ apt-get source mysql-community ``` Install GLib development libraries. ``` $ apt-get install libglib2.0-dev ``` Run autogen. ``` $ ./autogen.sh ``` Compile and generate Debian package. ``` $ debuild -uc -us -b ``` If development libraries are not available and you have downloaded the server source code, you can tell the build command it's location. ``` $ debuild --set-envvar MYSQLD_SOURCE=[mysqld_source_dir] -uc -us -b ``` ## Installing Install Debian package. ``` $ dpkg -i vn-mysql_[version]_[arch].deb ``` Register plugin and functions into MySQL. ``` INSTALL PLUGIN proxy_auth SONAME 'proxy_auth.so'; CREATE AGGREGATE FUNCTION minacum RETURNS INT SONAME 'minacum.so'; CREATE AGGREGATE FUNCTION multimax RETURNS INT SONAME 'multimax.so'; CREATE FUNCTION sql_printf RETURNS STRING SONAME 'sql_printf.so'; ``` ## Uninstalling Deregister plugin and functions from MySQL. ``` UNINSTALL PLUGIN proxy_auth; DROP FUNCTION IF EXISTS minacum; DROP FUNCTION IF EXISTS multimax; DROP FUNCTION IF EXISTS sql_printf; ``` ## Commands Obtain MySQL version from commandline. ``` $ mysql_config --version | cut -d "." -f 1 ``` ## Built with * [MySQL](https://dev.mysql.com/doc/refman/8.0/en/extending-mysql.html) * [GLib](https://developer.gnome.org/glib/) ## Documentation * [Writing plugins](https://dev.mysql.com/doc/refman/8.0/en/writing-plugins.html) * [Authentication plugins](https://dev.mysql.com/doc/refman/8.0/en/writing-authentication-plugins.html) * [Adding UDF](https://dev.mysql.com/doc/refman/8.0/en/adding-udf.html) * [GLib API reference](https://developer.gnome.org/glib/)