首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫

mysqldump 備份與還原常用指令速查

     編輯:MySQL 資料庫相關知識

1. 匯出整個資料庫

mysqldump -u 用戶名 -p 資料庫名 > 匯出檔名
mysqldump -u wcnc -p smgp_apps_wcnc > wcnc.sql

2. 匯出單一資料表

mysqldump -u 用戶名 -p 資料庫名 表名 > 匯出檔名
mysqldump -u wcnc -p smgp_apps_wcnc users > wcnc_users.sql

3. 匯出資料庫結構(無資料)

mysqldump -u wcnc -p -d --add-drop-table smgp_apps_wcnc > d:\wcnc_db.sql
# -d:無資料;--add-drop-table:每個 CREATE 前加 DROP TABLE

4. 匯入資料庫

mysql -u root -p
USE 資料庫名;
SOURCE d:\wcnc_db.sql
  1. 上一篇文章:
  2. 下一篇文章:
Copyright © 程式碼之家 All Rights Reserved