Linux 下導出數據庫命令

Linux 下導出/備份數據庫命令

 mysqldump -u用戶名 -p密碼 -d  數據庫名 > /想下載目錄/數據庫.sql

或者

mysqldump -u用戶名 -p密碼 -d  數據庫名 --set-gtid-purged=off > /想下載目錄/數據庫.sql

在這裏插入圖片描述
這裏的–set-gtid-purged=off是爲了解決一個Warning:
Warning: A partial dump from a server that has GTIDs will by default include the GTIDs of all transactions, even those that changed suppressed parts of the database. If you don’t want to restore GTIDs, pass --set-gtid-purged=OFF. To make a complete dump, pass --all-databases --triggers --routines --events.
在這裏插入圖片描述
這個warning和mysql版本有關,MySQL Distrib 5.6之後加入了全局事務標識符(global transaction identifier ,GTID)作爲在源(主)服務器上提交的每個事務中創建並關聯的惟一標識符。

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章