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

คำสั่งไคลเอนต์ MySQL (MySQL Client Commands)

MySQL ส่ง SQL Statement ไป Server เพื่อ Execute แต่มีคำสั่ง Built-in ที่ mysql ตีความเอง

ดูรายการคำสั่ง

mysql> help

รายการคำสั่งหลัก

คำสั่ง (Long)Shortคำอธิบาย
help\h, ?แสดง Help นี้
clear\cล้าง Statement ปัจจุบัน
connect\rReconnect (อาร์กิวเมนต์: db, host)
delimiter\dตั้งค่า Statement Delimiter
edit\eแก้ไขคำสั่งด้วย $EDITOR
ego\Gส่งคำสั่ง แสดงผลแนวตั้ง
exit/quit\qออกจาก mysql
go\gส่งคำสั่งไป Server
nopager\nปิด Pager
notee\tหยุดเขียน Outfile
pager\Pตั้งค่า Pager
print\pพิมพ์คำสั่งปัจจุบัน
prompt\Rเปลี่ยน Prompt
rehash\#Rebuild Completion Hash
source\.Execute SQL Script File
status\sดูสถานะ Server
system\!รัน Shell Command
tee\Tตั้งค่า Outfile (Append)
use\uใช้ Database อื่น
charset\Cเปลี่ยน Charset
warnings\Wแสดง Warning หลังทุก Statement

กฎการใช้งาน

  • Long form: ไม่ Case-sensitive, อาจลงท้าย ; ได้
  • Short form: Case-sensitive, ห้ามลงท้ายอะไร
  • Short form ใน /* ... */ หลายบรรทัด: ไม่รองรับ
  • Short form ใน /*! ... */ หรือ /*+ ... */: รองรับ

โหมด --binary-mode

ปิดทุกคำสั่งยกเว้น charset และ delimiter (Non-interactive, Input พิพ/Source)