เนื้อหาประกอบด้วย
- การ export ทั้งโครงสร้างและข้อมูล
- การ export เฉพาะโครงสร้าง
- การ export เฉพาะข้อมูล
- การ export แค่ 1 ตาราง
- การ export แบบยกเว้นตาราง
- การ import ข้อมูล
Dumping structures and data
To export structure and data run the following command
$ mysqldump -p -u [username] [dbname] > [dbname].sql
Dumping structures only
To export structures only run the following command
$ mysqldump -u [username] -p --no-data [dbname] > [dbname].sql
Dumping data only
To export data only run the following command
$ mysqldump -u -p [username] --no-create-info [dbname] > [dbname].sql
Dumping one table
To export one table run the following command
$ mysqldump -u [username] -p [dbname] [tablename] > [tableName].sql
Dumping ignore table
To export exclude tables run the following command
$ mysqldump -u [username] -p [dbname] --ignore-table=DB_NAME.table > [tableName].sql
Import data
To import the data run the following command
$ mysql -u [username] -p -D [dbname] < [tableName].sql
Reference: