Home > Database > Mysql Tutorial > body text

MySQL client logging

WBOY
Release: 2023-08-29 19:45:02
forward
1193 people have browsed it

MySQL 客户端日志记录

Let’s learn about client-side logging for MySQL. The mysql client can perform different types of logging of executed statements, and can do so interactively -

UNIX - Logging

On Unix, mysql writes statements to a history file. By default, this file is named .mysql_history in the user's home directory. To specify a different file name, the value of the MYSQL_HISTFILE environment variable must be set.

If the --syslog option is given, mysql will write statements to the system logging tools on various platforms. On Unix, this is called syslog.

Windows - Logging

On Windows, this is called the Windows Event Log. The destination where logged messages appear depends on the system. For example, on Linux, the target is usually the /var/log/messages file.

How does logging happen?

Let’s understand how logging happens -

For each enabled logging target, statement logging happens as described below -

  • Statement Will only be logged if executed interactively. When statements are read from a file or pipe, they are non-interactive. Statement logging can be suppressed with the --batch or --execute option.

  • If the statement matches an existing pattern, the statement will be ignored and will not be recorded in the "ignore" list.

  • mysql records each non-ignored, non-empty statement line separately.

  • If a non-ignored statement spans multiple lines and does not contain a terminating delimiter, mysql concatenates the lines to form a complete statement, maps newlines to spaces, and logs result and delimiter.

The above is the detailed content of MySQL client logging. For more information, please follow other related articles on the PHP Chinese website!

source:tutorialspoint.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!