1. 說明:
出發(fā)點(diǎn):
由于特殊原因,我們只想導(dǎo)出數(shù)據(jù)庫中的數(shù)據(jù)(insert into語句格式的),但是在網(wǎng)上找到的資源很少(關(guān)于linux),因此特撰此文。
2. 環(huán)境
- mysql
- mysql workbench
- ubuntu (linux)
3. 開始
- 打開workbench,連接上數(shù)據(jù)庫后進(jìn)入主界面;
- 在左側(cè)導(dǎo)航欄中,點(diǎn)擊MANAGEMENT中的
Data Export; - 默認(rèn)
Object Selection頁面中,在Select Database Objects to Export欄里勾選你要導(dǎo)出的數(shù)據(jù)庫; - 重頭戲
- 點(diǎn)擊右上方的
Advanced Options...按鈕,進(jìn)入高級(jí)設(shè)置界面; - 在
Inserts欄中,勾選extended-insert(本表所有數(shù)據(jù)只用一條insert into語句,如果你想一張表中的每條數(shù)據(jù)都對(duì)應(yīng)著一個(gè)insert into語句,你可以取消勾選本選項(xiàng),勾選上面的compelete-insert); - 在
SQL欄中,勾選comments和quote-names選項(xiàng); - 在
Tables欄中,務(wù)必勾選上no-create-info選項(xiàng); - 點(diǎn)擊右上角的
< Return按鈕,回到初始界面; - 在
Options欄中,點(diǎn)擊Export to Self-Contained File,在后面輸入導(dǎo)出路徑即可; - 點(diǎn)擊右下角
Start Export按鈕,導(dǎo)出成功;
4. 結(jié)語
本文在實(shí)際工程中有應(yīng)用到,希望能夠幫助到大家。ps:同時(shí),這也算是正式進(jìn)軍Markdown的寫作行列的milestone。圖片暫時(shí)沒時(shí)間加,更新的時(shí)候再弄上去吧。_