MySQL Logs Flashcards
True or False:
By default, no logs are enabled, except the error log on Windows
True
In what order do these steps occur for renaming a log file in a linux server:
A - $ mysqladmin flush-logs
B - $ mv host_name.err host_name.err-old
C - $ mv host_name.err-old backup-directory
a) ABC
b) BCA
c) BAC
d) CBA
c - BAC
$ mv host_name.err host_name.err-old
$ mysqladmin flush-logs
$ mv host_name.err-old backup-directory
True or False:
By default, the server writes files for all enabled logs in the usr directory
False
By default, the server writes files for all enabled logs in the data directory
True or False:
You can force the server to close and reopen the log files (or in some cases switch to a new log file) by flushing the logs
True
Name 2 ways to clean up these files regularly to ensure that the logs do not take up too much disk space
back up and remove old log files from time to time
tell MySQL to start logging to new files.
How do you force MySQL to start using new logs?
To force MySQL to start using new log files, flush the logs.
Execution of log-flushing statements or commands requires the server to have RELOAD privilege.
On Unix and Unix-like systems, another way to flush the logs is to send a signal to the server, which can be done by root or the account that owns the server process
Which logs are in binary file format? Choose 3.
a) binary log
b) DDL log
c) error log
d) relay log
e) general query log
a, b, d
the binary log, relay log, and DDL log are all in binary format.
Which statement cannot be used to view binary log?
a) mysqlbinlog [options] log_file
b) mysqlbin [options] log_file
c) SHOW BINLOG EVENTS IN ‘log_file’
d) BINLOG ‘str’
b
a) mysqlbinlog –> output includes events contained in log_file
c) SHOW BINLOG EVENTS IN ‘log_file’ –> Shows the events in the binary log. If you do not specify ‘log_name’, the first binary log is displayed
d) BINLOG ‘str’ –> the printable representation of certain events in binary log files.
BINLOG is an internal-use statement. It is generated by the mysqlbinlog program as the printable representation of certain events in binary log files.
Which option used in this statement is used to specify network interface to connect to MySQL Server?
mysqlbinlog [options] log_file
–bind-address
Which option used in this statement lists entries for just this database?
mysqlbinlog [options] log_file
–database
Which option used in this statement will write debugging log?
mysqlbinlog [options] log_file
–debug
Which option used in this statement will print debugging information when program exits?
mysqlbinlog [options] log_file
–debug-check
Which directory is the error log located in a linux system?
a) /var/log/mysql/
b) \ProgramData\MySQL\MySQL Server 8.0\Data\
c) /etc/mycnf
d) /var/lib/mysql/
a) /var/log/mysql/error.log
slow query and general query log files are found in /var/lib/mysql/mysql
Which directory is the error log located in a windows server?
a) /var/log/mysql/
b) \ProgramData\MySQL\MySQL Server 8.0\Data\
c) /var/lib/mysql
d) /etc/mysql/
b) \ProgramData\MySQL\MySQL Server 8.0\Data\
files are usually hidden
In what file would you find the location of the log files in a windows server?
a) /var/log/mysql/my.ini
b) \ProgramData\MySQL\MySQL Server 8.0\Data\my.ini
c) /var/lib/mysql
d) /etc/mysql/mycnf
b) \ProgramData\MySQL\MySQL Server 8.0\Data\my.ini
In what file would you find the location of the log files in a linux debian server?
a) /var/log/mysql/my.ini
b) \ProgramData\MySQL\MySQL Server 8.0\Data\my.ini
c) /etc/mycnf
d) /etc/mysql/mycnf
d) /etc/mysql/mycnf
In what file would you find the location of the log files in a linux Red Hat server?
a) /var/log/mysql/my.ini
b) \ProgramData\MySQL\MySQL Server 8.0\Data\my.ini
c) /etc/mycnf
d) /etc/mysql/mycnf
c) /etc/mycnf
Which of the following statements about the error log is false?
a) contains a record of mysqld startup and shutdown times.
b) Depending on configuration, error messages may also populate the Performance Schema error_log table, to provide an SQL interface to the log and enable its contents to be queried
c) when mysqld_safe notices abnormal mysqld exits, it restarts mysqld and writes a mysqld restarted message to the error log.
d) If used to start mysqld, mysqld_safe will not write messages to the error log.
e) contains diagnostic messages such as errors, warnings, and notes that occur during server startup and shutdown, and while the server is running.
d)
If used to start mysqld, mysqld_safe MAY write messages to the error log.
Which is not a feature of component-based error logging?
a) consists of a set of numbered files containing events that describe database changes, and an index file that contains the names of all used log files.
b) Log events can be filtered by filter components to affect the information available for writing.
c) Log events are output by sink (a destination for log events) components.
d) Built-in filter and sink components combine to implement the default error log format.
e) A loadable sink enables logging in JSON format and logging to the system log.
a)
relay logs consists of a set of numbered files containing events that describe database changes, and an index file that contains the names of all used relay log files.
Which system variable is described by the following?
global, dynamic
value = The components to enable for error logging.
loadable component named in the value must first be installed with INSTALL COMPONENT.
order is significant because the server executes components in the order listed
log_error_services
Which are the default values for log_error_services?
a) log_filter_internal; log_sink_internal
b) log_error_verbosity; log_error_supression_list
c) log_sink_internal; log_error_supression_list
d) log_sink_internal; log_error_verbosity
a) log_filter_internal; log_sink_internal
Which 2 variables affect the filtering performed by log_filter_internal?
log_error_verbosity → specifies the verbosity for handling events intended for the error log.
log_error_supression_list → applies to events intended for the error log and specifies which events to suppress when they occur with a priority of WARNING or INFORMATION.
Which is the default for log_error_verbosity?
a) value = 1 (error priority)
b) value = 2 (error, warning priority)
c) value = 3 (error, warning, information priority)
a) value = 1 (error priority)
Which statement is used to view log_error_services?
a) mysql> View @@GLOBAL.log_error_services;
b) mysql> SHOW @@GLOBAL.log_error_services;
c) mysql> SELECT @@GLOBAL.log_error_services;
c) mysql> SELECT @@GLOBAL.log_error_services;