MySQL日志【错误日志】

本文介绍了MySQL的错误日志功能,它是诊断数据库问题的重要工具。错误日志记录了服务器启动、停止及运行时的错误信息。通过指定--log_error选项可设置日志文件位置。示例中展示了日志内容,包括InnoDB初始化、数据库创建和关闭等过程。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

01. 错误日志

错误日志是mysql中最重要的日志之一,它记录了当mysql启动和停止时,以及服务器在运行过程中发生的任何严重错误时的相关信息。当数据库出现任何故障导致无法正常使用时,可以首先查看此日志。

可以用--log_error[=file_name]选项来指定mysqld(mysql服务器)保存错误日志文件的位置。如果没有给定file_name值,mysqld使用错误日志名host_name.err(host_name为知主机名)并默认在参数DATADIR(数据目录)指定的目录中写入日志文件。

[root@ufo128 mysql]# pwd
/var/lib/mysql

[root@ufo128 mysql]# more ufo128.err 
191013 12:19:45 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
191013 12:19:45  InnoDB: Initializing buffer pool, size = 8.0M
191013 12:19:45  InnoDB: Completed initialization of buffer pool
InnoDB: The first specified data file ./ibdata1 did not exist:
InnoDB: a new database to be created!
191013 12:19:45  InnoDB: Setting file ./ibdata1 size to 10 MB
InnoDB: Database physically writes the file full: wait...
191013 12:19:45  InnoDB: Log file ./ib_logfile0 did not exist: new to be created
InnoDB: Setting log file ./ib_logfile0 size to 5 MB
InnoDB: Database physically writes the file full: wait...
191013 12:19:45  InnoDB: Log file ./ib_logfile1 did not exist: new to be created
InnoDB: Setting log file ./ib_logfile1 size to 5 MB
InnoDB: Database physically writes the file full: wait...
InnoDB: Doublewrite buffer not found: creating new
InnoDB: Doublewrite buffer created
InnoDB: Creating foreign key constraint system tables
InnoDB: Foreign key constraint system tables created
191013 12:19:45  InnoDB: Started; log sequence number 0 0
191013 12:19:45 [Note] Event Scheduler: Loaded 0 events
191013 12:19:45 [Note] /usr/libexec/mysqld: ready for connections.
Version: '5.1.73'  socket: '/var/lib/mysql/mysql.sock'  port: 3306  Source distribution
191013 21:14:07 [Note] /usr/libexec/mysqld: Normal shutdown

191013 21:14:07 [Note] Event Scheduler: Purging the queue. 0 events
191013 21:14:07  InnoDB: Starting shutdown...
191013 21:14:13  InnoDB: Shutdown completed; log sequence number 0 44233
191013 21:14:13 [Note] /usr/libexec/mysqld: Shutdown complete

191013 21:14:13 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值