• tee [ file_name ] , \T [ file_name ] 

By using the --tee  option when you invoke mysql , you can log statements and their output. All the data displayed on the screen is appended into a given file. This can be very useful for debugging purposes also. mysql  flushes results to the file after each statement, just before it prints its next prompt. Tee functionality works only in interactive mode. 

You can enable this feature interactively with the tee  command. Without a parameter, the previous file is used. The tee  file can be disabled with the notee  command. Executing tee  again re-enables logging. 

• use db_name , \u db_name 

Use db_name  as the default database. 

• warnings , \W 

Enable display of warnings after each statement (if there are any). 

Here are a few tips about the pager  command: 

•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 -S  option. You may find it very useful for browsing wide query results. Sometimes a very wide result set is difficult to read on the screen. The -S  option to less  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 -S  interactively within less  to switch the horizontal-browse mode on and off. For more information, read the less  manual page: 

man less 

•The -F  and -X  options may be used with less  to cause it to exit if output fits on one screen, which 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 /dr1  and /dr2 , yet still display the results onscreen using less . 

You can also combine the tee  and pager  functions. Have a tee  file enabled and pager  set to less , and you are able to browse the results using the less  program and still have everything appended into a file the same time. The difference between the Unix tee  used with the pager  command and the mysql  built- in tee  command is that the built-in tee  works even if you do not have the Unix tee  available. The built- in tee  also logs everything that is printed on the screen, whereas the Unix tee  used with pager  does not log quite that much. Additionally, tee  file logging can be turned on and off interactively from within mysql . This is useful when you want to log some queries to a file, but not others. 

The prompt  command reconfigures the default mysql>  prompt. The string for defining the prompt can contain the following special sequences. 

