As we all know, mysqld_safe and mysqld are very different
mysqld : The database server instance daemon
mysqld_safe : Control program that examines and sets the environment for mysqld to execute. The mysqld executable is actually launched in a loop. When mysqld terminates, the mysqld_safe program will examine the return results and decide whether
- mysqld terminated normally (intentional shutdown), leaves mysqld_safe
- mysqld terminated abnormally (crash or kill -9 of mysqld)
- Loop back, mysqld fails on retry, leaves mysqld_safe
- Loop back, mysqld starts up, stays in the mysqld_safe loop
Why is it important to have mysqld and mysqld_safe using the same MySQL version?
Let me illustrate it this way: Percona Server sometimes has additional features in mysqld_safe for manipulating the OS. For example, I have seen numactl --interleave=all
in a Percona Server mysqld_safe. If that line was not there, the mysqld for Percona Server may run into issues with memory and swapping.
The same scenario could possibly be the case for Oracle's (ugh, still hate saying that) mysqld and mysqld_safe. There could be improvements from one major release to another that would be removed if the mysqld_safe was older.
Rather than exploring the possibilities of using a old mysqld_safe and a new mysqld (or vica versa), please make your life simple and reinstall MySQL 5.5.30 from scratch.
Before doing so, please run
updatedb
locate mysqld_safe
in Linux and see if there are two lingering. If there are, get the paths straightened out. Otherwise, you may have to reinstall MySQL 5.5.30.
You didn't say, in your question what the "file not present" message was, but I'm guessing it's this:
ERROR 1126 (HY000) at line 29: Can't open shared library 'lib_mysqludf_sys.so'
(errno: 0 /usr/local/mysql/lib/plugin/lib_mysqludf_sys.so: cannot open shared
object file: No such file or directory)
ERROR: unable to install the UDF
That makes sense, because you're telling gcc to write the file to /usr/lib/lib_mysqludf_sys.so... that's the -o
option in your command line. Give gcc the path MySQL is expecting and the rest of the installation should work.
gcc -m64 -fPIC -Wall -I/usr/include/mysql -I. -shared lib_mysqludf_sys.c \
-o /usr/local/mysql/lib/plugin/lib_mysqludf_sys.so \
-L/usr/lib/x86_64-linux-gnu/libstdc++.so.6
Also, whatever you're planning to do with this... don't say I didn't recommend against it. You're introducing both a potential security vulnerability and potentional performance and stability liability if these tools are deployed. This is not because there's anything wrong with the utility, but because of the amount of somewhat unorthodox functionality it opens up.
It's pretty cool, I admit. The lib_mysqludf_sys group of user-defined functions allow some interesting but easily-misappropriated capabilities, letting you spawn system commands and get either their generated output with sys_eval()
or their return value with sys_exec()
but really, I tend to suspect there's a reason why MySQL doesn't have these capabilities built in.
mysql> select sys_eval('df -k | grep xvda | tr -d "\n"') as cool_function_but_bad_idea;
+-----------------------------------------------------+
| cool_function_but_bad_idea |
+-----------------------------------------------------+
| /dev/xvda1 8256952 1216636 6620888 16% / |
+-----------------------------------------------------+
1 row in set (0.81 sec)
mysql> select sys_exec('/bin/false'), sys_exec('/bin/true');
+------------------------+-----------------------+
| sys_exec('/bin/false') | sys_exec('/bin/true') |
+------------------------+-----------------------+
| 256 | 0 |
+------------------------+-----------------------+
1 row in set (1.59 sec)
Update to address this error message:
gcc -Wall -m64 -I/usr/include/mysql -I. -shared lib_mysqludf_sys.c -o
/usr/lib/lib_mysqludf_sys.so -fPIC gcc: error: lib_mysqludf_sys.c: No such
file or directory gcc: fatal error: no input files compilation terminated
The statement in question is directing "gcc" to compile a 64-bit version from the source code, which is found in lib_mysqludf_sys.c. This is one of the files you downloaded, so, to compile it, you need to be inside the directory where you downloaded the lib_mysqludf_sys files. This error suggests that you aren't. The download package isn't limited to 32 bit, it's just that it only builds a 32 bit version unless you use the gcc -m64 -fPIC ...
statement.
Best Answer
According to the documentation, the SONAME should include the extension - '.so' in this case.