Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fedora 20. Plugin doesn't work #5

Open
samshm opened this issue Jul 15, 2014 · 6 comments
Open

Fedora 20. Plugin doesn't work #5

samshm opened this issue Jul 15, 2014 · 6 comments

Comments

@samshm
Copy link

samshm commented Jul 15, 2014

Hi,
Doesn't work!

Fedora: 20
Mysql..: 5.6.19

[lab@localhost ~]$ sestatus
SELinux status: disabled

Recompiled with
gcc -DMYSQL_DYNAMIC_PLUGIN -fPIC -Wall -I/usr/include/mysql -I. -shared lib_mysqludf_sys.c -o $(LIBDIR)/lib_mysqludf_sys.so

Plugin directory in /etc/my.cnf set to
plugin_dir=/var/lib/mysql/plugin

File lib_mysqludf_sys.so copied to /var/lib/mysql/plugin

Directory /var/lib/mysql/plugin owner set to mysql:
sudo chown mysql:mysql -R /var/lib/mysql/plugin

Permissions set to 777
chmod 777 -R /var/lib/mysql/plugin

Functions successfully created
DROP FUNCTION IF EXISTS lib_mysqludf_sys_info;
DROP FUNCTION IF EXISTS sys_get;
DROP FUNCTION IF EXISTS sys_set;
DROP FUNCTION IF EXISTS sys_exec;
DROP FUNCTION IF EXISTS sys_eval;

CREATE FUNCTION lib_mysqludf_sys_info RETURNS string SONAME 'lib_mysqludf_sys.so';
CREATE FUNCTION sys_get RETURNS string SONAME 'lib_mysqludf_sys.so';
CREATE FUNCTION sys_set RETURNS int SONAME 'lib_mysqludf_sys.so';
CREATE FUNCTION sys_exec RETURNS int SONAME 'lib_mysqludf_sys.so';
CREATE FUNCTION sys_eval RETURNS string SONAME 'lib_mysqludf_sys.so';

Tests terminal OK.
[lab@localhost test]$ ll /home/lab/test/
total 8
drwxrwxrwx 2 mysql mysql 4096 Jul 14 21:35 1
drwxrwxrwx 2 mysql mysql 4096 Jul 14 21:37 2

Test form mysql doesn't throw error but nothing is changed!

mysql> SELECT sys_exec('touch /var/lib/mysql/plugin/test.txt');
+--------------------------------------------------+
| sys_exec('touch /home/lab/test/1/test.txt') |
+--------------------------------------------------+
| 256 |
+--------------------------------------------------+
1 row in set (0.01 sec)

BUT modified date not changed!!!

mysql> SELECT sys_exec('cp /home/lab/test/1/test.txt /home/lab/test/2');
+-----------------------------------------------------------+
| sys_exec('cp /home/lab/test/1/test.txt /home/lab/test/2') |
+-----------------------------------------------------------+
| 256 |
+-----------------------------------------------------------+
1 row in set (0.01 sec)

File NOT copied!!!

Thanks,
Any ideas appreciated

@daper
Copy link

daper commented Jul 15, 2014

The plugin works fine, probably your environment is not well configured. Make the tests in /tmp.

@samshm
Copy link
Author

samshm commented Jul 15, 2014

Yes, you are right.
Permissions, Permissions, Permissions

All tests work in /tmp.

Thanks.

@CrazyNoob
Copy link

CrazyNoob commented Aug 9, 2016

@samshm @daper I'm having the same problem in ubuntu and I can't fix it, can you specify what is there to "configure" and what steps should I take? I have given permissions and even in the tmp folder the commands do not work

@daper
Copy link

daper commented Aug 9, 2016

Hi @CrazyNoob could you paste a test like @samshm ?

@CrazyNoob
Copy link

Hi @daper thanks for the quick reply

I ended up fixing the problem with a mix of your answer https://github.com/mysqludf/lib_mysqludf_sys/issues/4#issuecomment-48470107
and permissions on the folders that I was trying to run from sys_exec()

Nevertheless, could you provide an example on your statement "probably your environment is not well configured.". What would be a badly configured environment? What would a good one be?

@daper
Copy link

daper commented Aug 9, 2016

You are right... It's not a good answer. I only meant permissions to read, write and execute. There aren't a good or bad environment. Sorry :) I'm glad you were able to solve it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants