Oracle 5.0 Reference Manual page 295

Table of Contents

Advertisement

You can enable this feature interactively with the
file is used. The
tee
logging.
use
db_name,
\u db_name
Use
as the default database.
db_name
warnings,
\W
Enable display of warnings after each statement (if there are any). This command was added in
MySQL 5.0.6.
Here are a few tips about the
• You can use it to write to a file and the results go only to the file:
mysql>
pager cat > /tmp/log.txt
You can also pass any options for the program that you want to use as your pager:
mysql>
pager less -n -i -S
• In the preceding example, note the
results. Sometimes a very wide result set is difficult to read on the screen. The
can make the result set much more readable because you can scroll it horizontally using the left-
arrow and right-arrow keys. You can also use
browse mode on and off. For more information, read the
shell>
man less
• The
and
options may be used with
-F
-X
is convenient when no scrolling is necessary:
mysql>
pager less -n -i -S -F -X
• You can specify very complex pager commands for handling query output:
mysql>
pager cat | tee /dr1/tmp/res.txt \
| tee /dr2/tmp/res2.txt | less -n -i -S
In this example, the command would send query results to two files in two different directories on two
different file systems mounted on
You can also combine the
and you are able to browse the results using the
into a file the same time. The difference between the Unix
the
built-in
mysql
tee
available. The built-in
tee
used with
does not log quite that much. Additionally,
pager
off interactively from within mysql. This is useful when you want to log some queries to a file, but not
others.
The
command reconfigures the default
prompt
contain the following special sequences.
Option
Description
A counter that increments for each statement you issue
\c
The full current date
\D
The default database
\d
— The MySQL Command-Line Tool
mysql
file can be disabled with the
command:
pager
option. You may find it very useful for browsing wide query
-S
less
and /dr2, yet still display the results onscreen using less.
/dr1
and
functions. Have a
tee
pager
command is that the built-in
also logs everything that is printed on the screen, whereas the Unix
275
command. Without a parameter, the previous
tee
command. Executing
notee
interactively within
-S
less
manual page:
less
to cause it to exit if output fits on one screen, which
file enabled and
tee
program and still have everything appended
less
used with the
tee
works even if you do not have the Unix
tee
file logging can be turned on and
tee
prompt. The string for defining the prompt can
mysql>
again re-enables
tee
option to
-S
less
to switch the horizontal-
set to less,
pager
command and
pager
tee
tee

Advertisement

Table of Contents
loading

This manual is also suitable for:

Mysql 5.0

Table of Contents