At work, I run the mysql clients on multiple hosts with multiple versions. My home directory is a network mount and thus my .mysql_history file is shared between all these hosts. Often the command history gets weirdly munged, with spaces converted to
\040 — the character sequence for the octal escape code for ASCII space. Here’s a little workaround/fix:
/bin/sed 's/\\040/ /g;' ~/.mysql_history > ~/.mysql_history.space /bin/mv -f ~/.mysql_history.space ~/.mysql_history
Make that into an alias or script. Just make sure you quit all instances of the mysql client before running. Then when you restart, the history should get reloaded correctly.
I haven’t bothered to figure out why this is happening, i.e. what the version problems are or 32/64 bit or readline/editline or the sequence of starting multiple clients on multiple hosts…