Description:
In mysqld_safe you got code to set PLUGIN_DIR:
421 if [ -n "${PLUGIN_DIR}" ]; then
422 plugin_dir="${PLUGIN_DIR}"
423 else
424 # Try to find plugin dir relative to basedir
425 for dir in lib/mysql/plugin lib/plugin
426 do
427 if [ -d "${MY_BASEDIR_VERSION}/${dir}" ]; then
428 plugin_dir="${MY_BASEDIR_VERSION}/${dir}"
429 break
430 fi
431 done
432 # Give up and use compiled-in default
433 if [ -z "${plugin_dir}" ]; then
434 plugin_dir='/usr/local/mysql/lib/plugin'
435 fi
436 fi
437 plugin_dir="${plugin_dir}${PLUGIN_VARIANT}"
In fact parse_arguments() is the function to set PLUGIN_DIR.
But parse_arguments is called after setting plugin_dir:
#v+
488 parse_arguments `$print_defaults $defaults --loose-verbose mysqld server`
494 parse_arguments `$print_defaults $defaults --loose-verbose mysqld_safe safe_mysqld`
495 parse_arguments PICK-ARGS-FROM-ARGV "$@"
#v-
So as the first code uses a variable (PLUGIN_DIR) going to be defined later. This leads to plugin_dir='/usr/local/mysql/lib/plugin'
So every setting of plugin_dir is going to be ignored anyway.
I don"t see any reason to parse for plugin_dir anyway.
How to repeat:
Set plugin_dir in my.cnf and have a look at the processlist afterwards or just read the code :)
Suggested fix:
Don't let mysqld_safe handle --plugin-dir or move the Code after parse_argumens() has called.