mysql日志查看


https://www.2cto.com/database/201201/116116.html

 

是否啟用了日志
mysql>show variables like 'log_bin';
 
怎樣知道當前的日志
mysql> show master status;
 
看二進制日志文件用mysqlbinlog
shell>mysqlbinlog mail-bin.000001(要寫絕對問題路徑d://)
或者shell>mysqlbinlog mail-bin.000001 | tail
 
Windows 下用類似的命令。
 
 
mysql有以下幾種日志:  
   錯誤日志:     -log-err 
   查詢日志:     -log 
   慢查詢日志:   -log-slow-queries 
   更新日志:     -log-update 
   二進制日志:-log-bin 
   
   在mysql的安裝目錄下,打開my.ini,在后面加上上面的參數,保存后重啟mysql服務就行了。 
   例如:  
   #Enter a name for the error log file.   Otherwise a default name will be used.
   log-error=err.log
#Enter a name for the query log file. Otherwise a default name will be used.
   #log=
#Enter a name for the slow query log file. Otherwise a default name will be used.
   #log-slow-queries=
#Enter a name for the update log file. Otherwise a default name will be used.
   #log-update=
#Enter a name for the binary log. Otherwise a default name will be used.
   #log-bin=     
   上面只開啟了錯誤日志,要開其他的日志就把前面的“#”去掉。
 
long_query_time =1 --是指執行超過多久的sql會被log下來,這里是1秒
 
log-slow-queries=slowqueris.log --將查詢返回較慢的語句進行記錄
 
log-queries-not-using-indexes = nouseindex.log --就是字面意思,log下來沒有使用索引的query
 
log=mylog.log --對所有執行語句進行記錄
 
log-error=log-error.log
log=log-query.log
log-queries-not-using-indexes
log-warnings=2
log-slow-queries=log-slow-query.log
log-update=log-update.log
long_query_time=2


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM