MySQL Log details
Error Log
The MySQL error message is in the data directory.
The content defined in the error log itself can be defined.
Edit the configuration file and define the error log:
Log-error =/path/to/xx. err # define whether to enable the error log function
Log-warnings = {1 | 0} # define whether warning information is recorded in the error log
By default, the error log also records the following messages:
1. Information during server startup and Shutdown
It may not be an error message, such as how mysql initializes the storage engine and records the process in the error log.
2. error messages during server operation
For example, the sock file cannot be found and the data file of the mysql database cannot be loaded. If you forget to initialize mysql or the data dir path cannot be found, or the permission is incorrect, it will be recorded here
3. Information generated when the event scheduler runs an event
Once mysql schedules a scheduled task, it also records relevant information in the error log.
4. Information generated when the slave server process is started on the slave server
In the replication environment, the information of the slave server process is also recorded in the error log.
Generally, error logs are not very large and can be safely enabled, which is very helpful for diagnosing server faults or problems.
How to define mysql Server Error Log functions:
Mysql> showglobal variables like '% log % ';
+ ----------------------------------------- + --------------------------------- +
| Variable_name | Value |
+ ----------------------------------------- + --------------------------------- +
| Back_log | 50 |
| Bin log_cache_size | 32768 |
| Binlog_direct_non_transactional_updates | OFF |
| Binlog_format | MIXED |
| Binlog_stmt_cache_size | 1, 32768 |
| Expire_logs_days | 0 |
| General_log | OFF |
| General_log_file |/mydata/data/localhost. log |
| Innodb_flush_log_at_trx_commit | 1 |
| Innodb_locks_unsafe_for_binlog | OFF |
| Innodb_log_buffer_size | 8388608 |
| Innodb_log_file_size | 5242880 |
| Innodb_log_files_in_group | 2 |
| Innodb_log_group_home_dir |./|
| Innodb_mirrored_log_groups | 1 |
| Log | OFF |
| Log_bin | ON |
| Log_bin_trust_function_creators | OFF |
| Log_error |/mydata/data/localhost. err |
| Log_output | FILE |
| Log_queries_not_using_indexes | OFF |
| Log_slave_updates | OFF |
| Log_slow_queries | OFF |
| Log_warnings | 1 |
| Max_binlog_cache_size | 18446744073709547520 |
| Max_binlog_size | 1073741824 |
| Max_binlog_stmt_cache_size | 1, 18446744073709547520 |
| Max_relay_log_size | 0 |
| Relay_log |
| Relay_log_index |
| Relay_log_info_file | relay-log.info |
| Relay_log_purge | ON |
| Relay_log_recovery | OFF |
| Relay_log_space_limit | 0 |
| Slow_query_log | OFF |
| Slow_query_log_file |/mydata/data/localhost-slow.log |
| SQL _log_bin | ON |
| SQL _log_off | OFF |
| Sync_binlog | 0 |
| Sync_relay_log | 0 |
| Sync_relay_log_info | 0 |
+ ----------------------------------------- + --------------------------------- +
41 rows in set (0.00 sec)
Log storage path. The default path is hostname. err under the current path.
| Log_error |/mydata/data/localhost. err |
Write the warning information of the Service Database Service to localhost. err.
| Log_warnings | 1 |
Generally, errlog configuration parameters are
Log_error =/path/to/somefie
Log_warnings = {1 | 0}
Log-related functions are global, and some functions are statically defined.
[Root @ localhostdata] # pwd
/Mydata/data
[Root @ localhostdata] # hostname
Localhost
[Root @ localhostdata] # ll | grep err
-Rw-r ----- 1 mysqlroot 6220 Mar 31 14:32 localhost. err
-Rw-r ----- 1 mysqlroot 68129 Feb 26 test3.err
View error logs:
First, restart the mysql service process and observe the error log:
[Root @ localhostdata] # tail-20 localhost. err
140331 14:32:02 [Note]/usr/local/mysql/bin/mysqld: Shutdown complete
140331 14: 32: 02mysqld_safe mysqld from pid file/mydata/data/localhost. pid ended
140331 14: 32: 02mysqld_safe Starting mysqld daemon with databases from/mydata/data
140331 14:32:03 [Note] Plugin 'federated 'is disabled. # initialize the storage engine
140331 14: 32: 03 InnoDB: The InnoDB memory heap is disabled # innodb disables The heap Function
140331 14: 32: 03 InnoDB: Mutexes and rw_locks use GCC atomic builtins # The mutex volume and row-Level Lock are compiled by GCC.
140331 14: 32: 03 InnoDB: Compressed tables use zlib 1.2.3
140331 14: 32: 03 InnoDB: Using Linux native AIO
140331 14: 32: 03 InnoDB: Initializing buffer pool, size = 128.0 M # The buffer pool (buff poll) of the innodb Storage engine generally needs to be modified, and it needs to be greatly improved, generally, 8 GB of memory is allocated to 5 GB, which is not enough (For mysql scenarios)
Therefore, you can observe this file to observe the memory occupied by the buffer pool.
140331 14: 32: 03 InnoDB: Completed initialization of buffer pool
140331 14: 32: 03 InnoDB: highest supported file format is Barracuda.
140331 14:32:03 InnoDB: Waiting for the background threads tostart
140331 14: 32: 04 InnoDB: 5.5.33 started; log sequence number 2856278
140331 14:32:04 [Note] Server hostname (bind-address): '0. 0.0.0 '; port: 3306 # The service is running and listening to port 3306 of local 0.0.0.0
140331 14:32:04 [Note]-'0. 0.0.0 'resolves to '0. 0.0.0'; #0.0.0.0 anti-solution failed
140331 14:32:04 [Note] Server socket created on IP: '0. 0.0.0 '.
140331 14:32:04 [Note] Event schedents: Loaded 0 events # The Time Scheduler does not perform any Scheduling
140331 14:32:04 [Note]/usr/local/mysql/bin/mysqld: ready for connections.
Version: '5. 5.33-log 'socket: '/tmp/mysql. sock 'port: 3306 MySQL Community Server (GPL) # mysql has been started and generated under the/tmp/directory. sock File