| 用途 | 服务级事件日志 |
|---|---|
| 定位 | SHOW VARIABLES LIKE 'log_error'; |
| 位置 | /var/log/mysqld.log 或数据目录下的 .err 文件 |
查看日志
查看日志
mysql -uroot -p -e "SHOW VARIABLES LIKE 'log_error';"
tail -n 200 /var/log/mysqld.log
grep -iE 'error|warn' /var/log/mysqld.log | tail -50日志详细度配置
日志详细度配置
[mysqld]
log_error = /var/log/mysql/error.log
log_error_verbosity = 2 # 1=错误 2=+警告 3=+提示MySQL 8.0 若未显式配置 log_error,错误输出走 stderr 由 systemd 接管,用 journalctl -u mysqld 看。