Computer >> บทช่วยสอนคอมพิวเตอร์ >  >> การเขียนโปรแกรม >> MySQL

MySQL Client Logging

MySQL Client ทำ Logging สำหรับ Statement ที่ Execute แบบ Interactive

Unix - Logging

  • Default: ~/.mysql_history
  • เปลี่ยนไฟล์: ตั้ง MYSQL_HISTFILE Environment Variable
  • --syslog -> เขียนไป System Logging Facility (syslog)

Windows - Logging

  • Windows Event Log
  • Destination ขึ้นกับระบบ (Linux: /var/log/messages)

กฎการ Logging

  • Log เฉพาะ Statement แบบ Interactive (ไม่ใช่จาก File/Pipe)
  • ปิดได้ด้วย --batch หรือ --execute
  • Ignore Statement ที่ Match Pattern ใน "Ignore List"
  • Log ทุก Non-ignored, Non-empty Statement Line แยกกัน
  • Multi-line Statement -> Concatenate, Newline -> Space, Log พร้อม Delimiter