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

mysqlimport - โปรแกรมนำเข้าข้อมูล MySQL

mysqlimport ให้ CLI สำหรับ LOAD DATA SQL Statement Options ตอบโจทย์ Clauses ของ LOAD DATA โดยตรง

การเรียกใช้

shell> mysqlimport [options] db_name textfile1 [textfile2 ...]

การกำหนดชื่อตาราง

Strip Extension ออกจากชื่อไฟล์ -> ใช้เป็นชื่อตาราง

  • sample.txt, sample.text, sample -> ตาราง sample

ตัวเลือกสำคัญ

ตัวเลือกคำอธิบาย
--bind-address=ip_addressเลือก Network Interface
--character-sets-dir=dir_nameไดเรกทอรี Character Sets
--columns=column_list, -cรายชื่อคอลัมน์ คั่นด้วย Comma (ลำดับ = Mapping กับ File Columns)
--compress, -Cบีบอัดข้อมูล Client-Server
--compression-algorithms=valueCompression Algorithms ที่อนุญาต (Default: Uncompressed)
--enable-cleartext-pluginEnable mysql_clear_password Plugin
--force, -fIgnore Errors (เช่น Table ไม่มี -> ทำต่อ ไม่ใช่ Exit)