Problem with mysqldump: “--defaults-extra-file” option is not working as expected

蹲街弑〆低调 提交于 2019-11-30 07:48:50

I found the answer: --defaults-extra-file must be the first option. This works as expected:

...\right_path\mysqldump --defaults-extra-file=d:\1.cnf
                         --add-drop-database --databases my_database_name

I realize this is Linux-specific, but my searches brought me here.

I'm using bitnami's LAMP stack, and found out that their "mysqldump" is actually a script:

LD_LIBRARY_PATH=/opt/lampstack-5.5.3-0/mysql/lib:$LD_LIBRARY_PATH
export LD_LIBRARY_PATH
case "$@" in
  *--no-defaults*)
    exec $0.bin "$@"
    exit
esac
exec $0.bin --defaults-file=/opt/lampstack-5.5.3-0/mysql/my.cnf "$@"

which doesn't appear to allow --defaults-file to be passed in... and work (as per the accepted answer here).

Also meet this problem. Found there's another situation that would cause --defaults-extra-file option not recognized.

When you changed IFS in script, it's possible to hit this problem. The solution is to reset IFS before execute mysql statement.

For reference.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!