[CLUE-Tech] MySQL questions

Lynn Danielson lynn.danielson at clue.denver.co.us
Wed Jun 6 18:19:16 MDT 2001


Jeffery Cann wrote:
> 
> 1.  How do I turn off the pretty print of results sets?  i.e.,  I do not want
> the pipes:

By specifying batch mode -b or --batch when initiating the mysql client.
If you redirect stdout it will do this by default (I think), but when
you run the client interactively the default mode is tabular, that is
with the vertical bars.  You can also turn off column headers with the -N 
or --skip-column-names option.
 
> 2.  Is there another way to input data instead of command line redirection?
> For example, to run the bob.dat sql file:
> 
> $ mysql -u jccann -p < bob.dat
> 
> This is highly annoying because I must continuously restart the mysql command
> line client.  In most command-line SQL clients that I have used, one can
> normally execute a file with the 'input' or '@' command.  Is there a mysql
> equivalent to this?
> 
> $ mysql -u jccann -p
> mysql> input bob.dat

I think the "source" command is supposed to do this for you, e.g., 
mysql> source bob.dat 

Alternatively, you can simply suspend your current client with ^Z and 
execute "mysql -u jccann -p < bob.dat", then foreground (fg) your previous
client without really restarting anything.  Another option, unless you're
limited to a single terminal, is to run your redirected input commands from
a different terminal.  Running multiple mysql clients shouldn't be a 
problem. 

If you are limited to a single terminal, check out "screen".  It can be
invaluable for remote terminal monitoring.

Hope this helps,

Lynn



More information about the clue-tech mailing list