I want to share a discovery that helped me a lot. This is a MySQL UDF plugin that can run bash scripts and commands from MySQL. In my case, it was very interesting to create triggers associated with a particular table.
- Download from: https://github.com/mysqludf/lib_mysqludf_sys/archive/master.zip
- Open the folder and edit the Makefile:
- We will install some compilation tools.
sudo apt-get install build-essentialsudo apt-get install libmysqlclient15-dev- If you cannot install the latest tool from the repository, do
sudo apt-get update to update them. - Add
-fPIC In the gcc command we compile the plugin. - Modify the LIBDIR variable to point to the mysqld plugins folder, usually:
LIBDIR = / usr / lib / mysql / plugin
make
./Install.sh.- Already installed but disabled. To turn on:
sudo Ln -s /etc/apparmor.d/usr.sbin.mysqld /etc/apparmor.d/disable/sudo Apparmor_parser -R /etc/apparmor.d/usr.sbin.mysqldto verify the installation, you can start the MySQL console:
SELECT sys_eval ("id")
if it returns something like:
uid = 122 (mysql) gid = 130 (mysql) groups = 130 (mysql)
installation successful
I hope you find this helpful.
Literature:
http://dev.mysql.com/doc/refman/5.7/en/faqs-triggers.html#qandaitem-23-5-1-11
http://jawtech.com/drupal7/?q=content/how-create-mysql-triggers-execute-external-scriptphp-ubuntu-server-14
linux bash mysql ubuntu
Baurin Leza Oct 13 '16 at 15:38 2016-10-13 15:38
source share