【轉】[Mysql] Linux Mysql 日誌專題

來源:互聯網
上載者:User

標籤:

原文連結:http://blog.csdn.net/xiaoxu0123/article/details/6258538

 

1, 設定存放的目錄:

[[email protected] etc]# more /etc/my.cnf 
[mysqld]
###此處省略N個字
log-error=/var/log/mysql/mysql_error.log    #錯誤記錄檔
log=/var/log/mysql/mysql.log                       ###最好注釋掉,會產生大量的日誌,包括每一個執行的sql及環境變數的改變等等
log-bin=/var/log/mysql/mysql_bin.log          # 用於備份恢複,或主從複製. 查看及清除方法,見本部落格的另一個文單binlog
log-slow-queries=/var/log/mysql/mysql_slow.log  #慢查詢日誌

 

[mysqld_safe]
log-error=/var/log/mysql/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid

 

2, 配置後需要重啟mysql

[[email protected] etc]#  /etc/init.d/mysqld restart

 

 

3, 查看日誌:

普通日誌查看:

[[email protected] mysql]# ls
mysql_bin.000001 mysql_bin.index mysqld.log mysql_error.log mysql.log mysql_slow.log

使用Cat or More *.log 可以查看普通日誌

【轉】[Mysql] Linux Mysql 日誌專題

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.