02-错误日志
错误日志是MySQL中最重要的日志之一,它记录了当mysqld启动和停止时,以及服务器在运行过程中发生任何严重错误时的相关信息。当数据库出现任何故障导致无法正常使用时,可以首先查看此日志。
可以用--log-error[=file_name]选项来指定mysqld(MySQL服务器)保存错误日志文件的位置。如果没有给定file_name值,mysqld使用错误日志名host_name.err(host_name为主机名)并默认在参数DATADIR(数据目录)指定的目录中写入日志文件。
以下是MySQL正常启动和关闭的一段日志,不同的版本可能略有不同:
[root@localhost mysql]# more localhost.localdomain.err
070727 04:24:46 mysqld started
InnoDB: The first specified data file ./ibdata1 did not exist:
InnoDB: a new database to be created!
070727 4:24:46 InnoDB: Setting file ./ibdata1 size to 10 MB
InnoDB: Database physically writes the file full: wait...
070727 4:24:46 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...
070727 4:24:46 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
070727 4:24:47 InnoDB: Started; log sequence number 0 0
070727 4:24:47 [Note] /usr/sbin/mysqld: ready for connections.
Version: '5.0.41-community' socket: '/var/lib/mysql/mysql.sock' port: 3306 MySQL Community Edition (GPL)
070727 6:20:27 [Note] /usr/sbin/mysqld: Normal shutdown
070727 6:20:27 InnoDB: Starting shutdown...
070727 6:20:28 InnoDB: Shutdown completed; log sequence number 0 43655
070727 6:20:28 [Note] /usr/sbin/mysqld: Shutdown complete
070727 06:20:28 mysqld ended