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

ดาวน์โหลด MySQL Command Line Client สำหรับ Windows

วิธีติดตั้ง MySQL Command Line Client บน Windows

ขั้นตอนการดาวน์โหลด

  1. เข้าเว็บไซต์ ufficiale: https://dev.mysql.com/downloads/mysql/
  2. เลือก Operating System: Windows (x86, 32/64-bit)
  3. เลือกประเภท Installer:
    • Web Installer (mysql-installer-web-community) - ไฟล์เล็ก ดาวน์โหลดส่วนประกอบตอนติดตั้ง
    • Full Installer (mysql-installer-community) - ไฟล์ใหญ่ ครบหมดในไฟล์เดียว (แนะนำสำหรับ Offline)
  4. คลิก Download (อาจต้อง Login Oracle Account หรือคลิก "No thanks, just start my download")
  5. รันไฟล์ .msi ที่ดาวน์โหลดมา

การติดตั้ง (Installation Wizard)

  1. เลือก Setup Type: Developer Default (ครบเครื่อง), Server Only, Client Only, Custom
  2. ติดตั้ง Components ที่ขาด (Visual C++ Redistributable, Python ฯลฯ)
  3. ตั้งค่า Root Password และ Authentication Method (Strong Password Encryption แนะนำ)
  4. ตั้งค่า Windows Service: Service Name, Port (Default 3306), Start at Boot
  5. Apply Configuration → Finish

การใช้งาน Command Line Client

หลังติดตั้งเสร็จ จะมี 2 ทางเข้าหลัก:

  • MySQL 8.0 Command Line Client - โปรแกรม Console แยกต่างหาก (Start Menu → MySQL → MySQL 8.0 Command Line Client)
  • Windows Command Prompt / PowerShell - พิมพ์ mysql -u root -p (ต้องเพิ่ม Path ใน Environment Variables)

เพิ่ม MySQL เข้า PATH (ถ้ายังไม่มี)

setx PATH "%PATH%;C:\Program Files\MySQL\MySQL Server 8.0\bin"

หรือเพิ่มผ่าน GUI: System Properties → Environment Variables → Path → Edit → New

ทดสอบการเชื่อมต่อ

mysql -u root -p
Enter password: ********
Welcome to the MySQL monitor...