Mysql
 sql >> Datenbank >  >> RDS >> Mysql

MySQL-UDF sys_exec() funktioniert nicht

Versuchen Sie:

mysql> SELECT VERSION();
+-----------------+
| VERSION()       |
+-----------------+
| 5.5.35-1ubuntu1 |
+-----------------+
1 row in set (0.00 sec)

mysql> SHOW VARIABLES LIKE 'plugin_dir';
+---------------+------------------------+
| Variable_name | Value                  |
+---------------+------------------------+
| plugin_dir    | /usr/lib/mysql/plugin/ | -- copy 'lib_mysqludf_sys.so' here
+---------------+------------------------+
1 row in set (0.01 sec)

mysql> DROP FUNCTION IF EXISTS lib_mysqludf_sys_info;
Query OK, 0 rows affected, 1 warning (0.00 sec)

mysql> DROP FUNCTION IF EXISTS sys_get;
Query OK, 0 rows affected, 1 warning (0.00 sec)

mysql> DROP FUNCTION IF EXISTS sys_set;
Query OK, 0 rows affected, 1 warning (0.00 sec)

mysql> DROP FUNCTION IF EXISTS sys_exec;
Query OK, 0 rows affected, 1 warning (0.00 sec)

mysql> DROP FUNCTION IF EXISTS sys_eval;
Query OK, 0 rows affected, 1 warning (0.00 sec)

mysql> CREATE FUNCTION lib_mysqludf_sys_info RETURNS string SONAME 'lib_mysqludf_sys.so';
Query OK, 0 rows affected (0.00 sec)

mysql> CREATE FUNCTION sys_get RETURNS string SONAME 'lib_mysqludf_sys.so';
Query OK, 0 rows affected (0.00 sec)

mysql> CREATE FUNCTION sys_set RETURNS int SONAME 'lib_mysqludf_sys.so';
Query OK, 0 rows affected (0.00 sec)

mysql> CREATE FUNCTION sys_exec RETURNS int SONAME 'lib_mysqludf_sys.so';
Query OK, 0 rows affected (0.00 sec)

mysql> CREATE FUNCTION sys_eval RETURNS string SONAME 'lib_mysqludf_sys.so';
Query OK, 0 rows affected (0.00 sec)

mysql> SELECT sys_exec('curl http://stackoverflow.com/');
+--------------------------------------------+
| sys_exec('curl http://stackoverflow.com/') |
+--------------------------------------------+
|                                          0 |
+--------------------------------------------+
1 row in set (0.12 sec)

Weitere Einzelheiten finden Sie unter:24.3.2.5 Kompilieren und Installieren des Benutzers -Definierte Funktionen .