在 mysql 服务器中设置错误日志

在 mysql 服务器中设置错误日志

我的 mysql 服务器在 ubuntu 服务器上崩溃了。我需要检索日志。执行以下操作时:mysql> show variable like '%log%'; 我得到:

+-----------------------------------------+---------------------------------------+
| Variable_name                           | Value                                 |
+-----------------------------------------+---------------------------------------+
| back_log                                | 50                                    |
| binlog_cache_size                       | 32768                                 |
| binlog_direct_non_transactional_updates | OFF                                   |
| binlog_format                           | STATEMENT                             |
| binlog_stmt_cache_size                  | 32768                                 |
| expire_logs_days                        | 10                                    |
| general_log                             | ON                                    |
| general_log_file                        | /var/log/mysql/mysql.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                                     | ON                                    |
| log_bin                                 | OFF                                   |
| log_bin_trust_function_creators         | OFF                                   |
| log_error                               |                                       |
| 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                         | 104857600                             |
| max_binlog_stmt_cache_size              | 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                     | /var/lib/mysql/echidna-music-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)

据我所知,没有定义文件来记录错误,对吗?

尽管我已将以下内容添加到 my.cnf:[mysqld_safe] log-error = /var/log/mysql/err.log

如何实现错误日志记录?

答案1

尝试将 [mysqld_safe] 部分下已有的“log-error”定义移动到 [mysqld] 部分

所以:

[mysqld]
log-error = /path/to/log/file

相关内容