mysql — The MySQL Command-Line Client • Use an option file.  You can set the  prompt  option in the  [mysql]  group of any MySQL option file, such as  /etc/my.cnf  or the  .my.cnf  file in your home directory. For example: • Set the prompt interactively.  You can change your prompt interactively by using the  prompt  (or  \R ) command. For example: •On Unix,  mysql  writes the statements to a history file. By default, this file is named  .mysql_history in your home directory. To specify a different file, set the value of the  MYSQL_HISTFILE  environment variable. •On all platforms, if the  --syslog  option is given,  mysql  writes the statements to the system logging facility. On Unix, this is  syslog ; on Windows, it is the Windows Event Log. The destination where logged messages appear is system dependent. On Linux, the destination is often the  /var/log/ messages  file. •How Logging Occurs •Controlling the History File •syslog Logging Characteristics •Statements are logged only when executed interactively. Statements are noninteractive, for example, when read from a file or a pipe. It is also possible to suppress statement logging by using the  --batch or  --execute  option. In this example, note that the backslashes are doubled. If you set the prompt using the  prompt  option in an option file, it is advisable to double the backslashes when using the special prompt options. There is some overlap in the set of permissible prompt options and the set of special escape sequences that are recognized in option files. (The rules for escape sequences in option files are listed in Section 4.2.2.2, “Using Option Files” .) The overlap may cause you problems if you use single backslashes. For example, \s  is interpreted as a space rather than as the current seconds value. The following example shows how to define a prompt within an option file to include the current time in  hh:mm:ss >  format: The  mysql  client can do these types of logging for statements executed interactively: The following discussion describes characteristics that apply to all logging types and provides information specific to each logging type. For each enabled logging destination, statement logging occurs as follows: How Logging Occurs 4.5.1.3 mysql Client Logging shell>  mysql --prompt="(\u@\h) [\d]> " (user@host) [database]> [mysql] prompt=(\\u@\\h) [\\d]>\\_ [mysql] prompt="\\r:\\m:\\s> " mysql>  prompt (\u@\h) [\d]>\_ PROMPT set to ’(\u@\h) [\d]>\_’ ( user @ host ) [ database ]> ( user @ host ) [ database ]> prompt Returning to default PROMPT of mysql> mysql> 440