MySQL 错误日志(Error Log)(2)

#停止mysql服务器
SZDB:~ # service mysql stop
Shutting down MySQL....                                              done

#使用配置文件来设置log-error参数
SZDB:~ # echo "log-error=/tmp/SZDB.err">>/etc/my.cnf
SZDB:~ # echo "skip_opt">>/etc/my.cnf    #添加一个异常参数skip_opt
SZDB:~ # grep -v ^# /etc/my.cnf
[mysqld]
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
log-error=/tmp/SZDB.err
skip_opt

#Author : Leshami
#Blog  :
#启动mysql服务器
SZDB:~ # mysqld_safe --user=mysql &
[1] 7315
SZDB:~ # 140907 13:40:33 mysqld_safe Logging to '/tmp/SZDB.err'.
140907 13:40:33 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
140907 13:40:33 mysqld_safe mysqld from pid file /var/lib/mysql/SZDB.pid ended
[1]+  Done                    mysqld_safe --user=mysql
SZDB:~ # more /tmp/SZDB.err
140907 13:40:33 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
140907 13:40:33 [ERROR] /usr/sbin/mysqld: ambiguous option '--skip-opt' (--skip-optimizer_prune_level)
140907 13:40:33 [ERROR] Aborting          #出现错误提示为有歧义的参数,实例终止
140907 13:40:33 mysqld_safe mysqld from pid file /var/lib/mysql/SZDB.pid ended

#修改my.cnf,删除skip-opt选项
SZDB:~ # vi /etc/my.cnf
SZDB:~ # grep -v ^# /etc/my.cnf
[mysqld]
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
log-error=/tmp/SZDB.err

#再次启动mysql服务器
SZDB:~ # mysqld_safe --user=mysql &   
[1] 7511
SZDB:~ # 140907 13:43:23 mysqld_safe Logging to '/tmp/SZDB.err'.
140907 13:43:23 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
SZDB:~ # more /tmp/SZDB.err
140907 13:40:33 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
140907 13:40:33 [ERROR] /usr/sbin/mysqld: ambiguous option '--skip-opt' (--skip-optimizer_prune_level)
140907 13:40:33 [ERROR] Aborting
#以下内容为正常启动的相关信息
140907 13:40:33 mysqld_safe mysqld from pid file /var/lib/mysql/SZDB.pid ended
140907 13:43:23 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
140907 13:43:23 [Note] Plugin 'FEDERATED' is disabled.
140907 13:43:23 InnoDB: The InnoDB memory heap is disabled
140907 13:43:23 InnoDB: Mutexes and rw_locks use GCC atomic builtins
140907 13:43:23 InnoDB: Compressed tables use zlib 1.2.3
140907 13:43:23 InnoDB: Using Linux native AIO
140907 13:43:23 InnoDB: Initializing buffer pool, size = 128.0M
140907 13:43:23 InnoDB: Completed initialization of buffer pool
140907 13:43:23 InnoDB: highest supported file format is Barracuda.
140907 13:43:23  InnoDB: Waiting for the background threads to start
140907 13:43:24 InnoDB: 5.5.37 started; log sequence number 1620641
140907 13:43:25 [Note] Server hostname (bind-address): '0.0.0.0'; port: 3306
140907 13:43:25 [Note]  - '0.0.0.0' resolves to '0.0.0.0';
140907 13:43:25 [Note] Server socket created on IP: '0.0.0.0'.
140907 13:43:25 [Note] Event Scheduler: Loaded 0 events
140907 13:43:25 [Note] /usr/sbin/mysqld: ready for connections.
Version: '5.5.37-log'  socket: '/var/lib/mysql/mysql.sock'  port: 3306  MySQL Community Server (GPL)

从上面的错误日可以看出,错误日志文件的格式,通常如下:
  时间  [错误级别]  错误信息
  有些日志信息不一定包含错误级别

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/a4ce8da9448d093a6ecaf89ed9412b18.html