日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 运维知识 > 数据库 >内容正文

数据库

mysql错误日志为aborting_MySQL 错误日志(Error Log)

發(fā)布時間:2024/7/5 数据库 27 豆豆
生活随笔 收集整理的這篇文章主要介紹了 mysql错误日志为aborting_MySQL 错误日志(Error Log) 小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.

同大多數(shù)關(guān)系型數(shù)據(jù)庫一樣,日志文件是MySQL數(shù)據(jù)庫的重要組成部分。MySQL有幾種不同的日志文件。通常包括錯誤日志文件,二進制日志,通用日志,慢查詢?nèi)罩?#xff0c;等等。

這些日志能夠幫助我們定位mysqld內(nèi)部發(fā)生的事件,數(shù)據(jù)庫性能故障,記錄數(shù)據(jù)的變更歷史,用戶恢復(fù)數(shù)據(jù)庫等等。本文主要描寫敘述錯誤日志文件。

1、MySQL日志文件系統(tǒng)的組成

a、錯誤日志:記錄啟動、運行或停止mysqld時出現(xiàn)的問題。

b、通用日志:記錄建立的client連接和運行的語句。

c、更新日志:記錄更改數(shù)據(jù)的語句。該日志在MySQL 5.1中已不再使用。

d、二進制日志:記錄全部更改數(shù)據(jù)的語句。

還用于復(fù)制。

e、慢查詢?nèi)罩?#xff1a;記錄全部運行時間超過long_query_time秒的全部查詢或不使用索引的查詢。

f、Innodb日志:innodb redo log

缺省情況下,全部日志創(chuàng)建于mysqld數(shù)據(jù)文件夾中。

能夠通過刷新日志,來強制mysqld來關(guān)閉和又一次打開日志文件(或者在某些情況下切換到一個新的日志)。

當你運行一個FLUSH LOGS語句或運行mysqladmin flush-logs或mysqladmin refresh時。則日志被老化。

對于存在MySQL復(fù)制的情形下。從復(fù)制server將維護很多其它日志文件,被稱為接替日志。

2、錯誤日志

錯誤日志是一個文本文件。

錯誤日志記錄了MySQL Server每次啟動和關(guān)閉的具體信息以及運行過程中全部較為嚴重的警告和錯誤信息。

能夠用--log-error[=file_name]選項來開啟mysql錯誤日志。該選項指定mysqld保存錯誤日志文件的位置。

對于指定--log-error[=file_name]選項而未給定file_name值,mysqld使用錯誤日志名host_name.err 并在數(shù)據(jù)文件夾中寫入日志文件。

在mysqld正在寫入錯誤日志到文件時。運行FLUSH LOGS 或者mysqladmin flush-logs時。server將關(guān)閉并又一次打開日志文件。

建議在flush之前手動重命名錯誤日志文件,之后mysql服務(wù)將使用原始文件名稱打開一個新文件。

下面為錯誤日志備份方法:

shell> mv host_name.err host_name.err-old

shell> mysqladmin flush-logs

shell> mv host_name.err-old backup-directory

3、實戰(zhàn)演示

#啟用錯誤日志,缺省情況下文件名稱為: hostname.err

#下面2種方式均可進行錯誤日志的配置

--log-error=file_name #命令行選項(command option)log-error=file_Name?? #配置文件(configure file)

#查看當前的錯誤日志配置,缺省情況下位于數(shù)據(jù)文件夾

mysql> show variables like ‘log_error‘;

+---------------+-------------------------+

| Variable_name | Value?????????????????? |

+---------------+-------------------------+

| log_error???? | /var/lib/mysql/SZDB.err |

+---------------+-------------------------+

1 row in set (0.00 sec)

#查看當前mysql server錯誤日志文件

SZDB:/var/lib/mysql # tail SZDB.err

140906 22:06:45 InnoDB: Completed initialization of buffer pool

140906 22:06:45 InnoDB: highest supported file format is Barracuda.

140906 22:06:45? InnoDB: Waiting for the background threads to start

140906 22:06:46 InnoDB: 5.5.37 started; log sequence number 1605345

140906 22:06:47 [Note] Server hostname (bind-address): ‘0.0.0.0‘; port: 3306

140906 22:06:47 [Note]?? - ‘0.0.0.0‘ resolves to ‘0.0.0.0‘;

140906 22:06:47 [Note] Server socket created on IP: ‘0.0.0.0‘.

140906 22:06:47 [Note] Event Scheduler: Loaded 0 events

140906 22:06:47 [Note] /usr/sbin/mysqld: ready for connections.

Version: ‘5.5.37-log‘? socket: ‘/var/lib/mysql/mysql.sock‘? port: 3306? MySQL Community Server (GPL)

#停止mysqlserver

SZDB:~ # service mysql stop

Shutting down MySQL....?????????????????????????????????????????????? done

#使用配置文件來設(shè)置log-error參數(shù)

SZDB:~ # echo "log-error=/tmp/SZDB.err">>/etc/my.cnf

SZDB:~ # echo "skip_opt">>/etc/my.cnf???? #加入一個異常參數(shù)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?? :http://blog.csdn.net/leshami

#啟動mysqlserver

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????????? #出現(xiàn)錯誤提示為有歧義的參數(shù),實例終止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

#再次啟動mysqlserverSZDB:~ # 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

#下面內(nèi)容為正常啟動的相關(guān)信息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)

從上面的錯誤日能夠看出。錯誤日志文件的格式。通常例如以下:

時間? [錯誤級別]? 錯誤信息

有些日志信息不一定包括錯誤級別

總結(jié)

以上是生活随笔為你收集整理的mysql错误日志为aborting_MySQL 错误日志(Error Log)的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯,歡迎將生活随笔推薦給好友。