Is there a way to prevent the default mysql client from ?:

  • 'removing newlines'
  • a.k.a. 'converting newlines to spaces'
  • a.k.a. 'mapping newlines to spaces'

Being more specific, with 'default mysql client' i mean the one in a terminal, command-line, shell or whatever you like to call it.

I didn't see an option for it at http://dev.mysql.com/doc/refman/5.6/en/mysql-logging.html and couldn't easily find a solution.

My guess is that it will be hard because it logs to a file ( e.g. ~/.mysql_history), like other shells do (e.g. ~/.bash_history). But I thought it couldn't hurt to ask. Here's to hoping for workarounds, hacks or something like that.

  • Are you talking about this? bazaar.launchpad.net/~mysql/mysql-server/5.7/view/head:/client/… (removing of end of line characters) If you are, binary-mode is what you are looking for, only available from 5.6.
    – jynus
    Jul 11 '14 at 20:02
  • It sounds like you're referring to the "MySQL Command Line Client" and the way it stores queries with newlines in such a way that you can't easily "up-arrow" back through those queries in order to run them again, because they're stored in the history as individual lines. Right? Jul 13 '14 at 5:28
  • Yes, i am referring to the easy 'up-arrow' to go back through previous queries in the Command Line Client. So i guess i will try that binary-mode. For people using ubuntu, it seems to be available in the universe-repository askubuntu.com/a/463383/4580 . Jul 15 '14 at 6:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.