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

ดูรายการตารางในฐานข้อมูลด้วย mysqlshow

ใช้โปรแกรม mysqlshow

เครื่องมือ command line สำหรับดูโครงสร้างฐานข้อมูล/ตาราง/คอลัมน์

Syntax

mysqlshow -u root db_name [pattern]

ตัวอย่าง: ดูทุกตารางใน database 'query'

C:\mysql\bin> mysqlshow -u root query
Database: query
+---------------------+
| Tables              |
+---------------------+
| cars                |
| cars_avgprice       |
| customers           |
| detail_bday         |
| emp                 |
| emp123              |
| emp_t               |
| examination_btech   |
| first_view          |
| info                |
| item_list           |
| item_list1          |
| new_number          |
| reservation         |
| reservations        |
| reserve             |
| student             |
| student_detail      |
| student_info        |
| student_marks       |
| tender              |
| tender1             |
| view_detail         |
| view_student_detail |
| website             |
+---------------------+

ตัวอย่าง: Pattern matching (ตารางที่มี 'student' ในชื่อ)

C:\mysql\bin> mysqlshow -u root query %student%
Database: query
Wildcard: %student%
+---------------------+
| Tables              |
+---------------------+
| student             |
| student_detail      |
| student_info        |
| student_marks       |
| view_student_detail |
+---------------------+

ตัวเลือกเพิ่มเติม

  • --count: แสดงจำนวนแถว
  • --status: แสดงข้อมูลเพิ่มเติม
  • -p: ใส่รหัสผ่าน