tom--bo / mysqlredo

Other
12 stars 2 forks source link

mysqlredo should not read `[client]` conifg group #11

Open yoku0825 opened 2 weeks ago

yoku0825 commented 2 weeks ago

Now mysqlredo reads [client] config group in my.cnf.

https://github.com/tom--bo/mysqlredo/blob/fb8e8a2de3934e48dbcf4772a188c931b9ab68a0/client/mysqlredo.cc#L37

But mysqlredo does not speak MySQL Procotol, it should not be treated as client. (mysqlbinlog speaks MySQL Protocol!)

Reading [client] config group easily leads unexpected behavior.

echo -e "[client]\nuser=root" > $HOME/.my.cnf
mysqlredo
mysqlredo: [ERROR] unknown variable 'user=root'.
yoku0825 commented 2 weeks ago

Workaround: alias mysqlredo="mysqlredo --no-defaults"

tom--bo commented 2 weeks ago

@yoku0825 Thank you very much for your report yoku-san. It's hard to ignore [client] section because this tool is implemented as mysqlclient. I agree to add --no-defaults option at first. So, I implemented to add this option if not exists. How do you think https://github.com/tom--bo/mysqlredo/pull/12 ?

tom--bo commented 2 weeks ago

Oh, it might be ok to set nullptr at 2nd field of load_default_groups[], https://github.com/tom--bo/mysqlredo/blob/main/storage/myisam/myisamchk.cc#L58 Sorry, I need to investigate this option.