MySQL 數(shù)據(jù)庫(kù)導(dǎo)入與導(dǎo)出,實(shí)例演示
以下的文章主要介紹的是MySQL 數(shù)據(jù)庫(kù)導(dǎo)入與導(dǎo)出的實(shí)際操作流程以及在實(shí)際操作中我們所要用到相關(guān)的腳本文件的介紹,以下就是文章的詳細(xì)內(nèi)容描述,望在你今后的學(xué)習(xí)會(huì)對(duì)你有所幫助。
1.導(dǎo)出整個(gè)數(shù)據(jù)庫(kù)
MySQLdump -u 用戶名 -p 密碼 數(shù)據(jù)庫(kù)名 > 導(dǎo)出的文件名
- MySQLdump -u jason -p jason roomdatadb> roomdatadb.sql
2.導(dǎo)出一個(gè)表
MySQLdump -u 用戶名 -p 密碼 數(shù)據(jù)庫(kù)名 表名> 導(dǎo)出的文件名
- MySQLdump -u jason -p jason roomdatadb t_roomdata> t_roomdata.sql
3.導(dǎo)出一個(gè)數(shù)據(jù)庫(kù)結(jié)構(gòu)
- MySQLdump -u jason -p jason -d --add-drop-table roomdatadb> d:\roomdatadb.sql
-d 沒(méi)有數(shù)據(jù) --add-drop-table 在每個(gè)create語(yǔ)句之前增加一個(gè)drop table
4.MySQL 數(shù)據(jù)庫(kù)導(dǎo)入數(shù)據(jù)庫(kù)
常用source 命令
進(jìn)入MySQL數(shù)據(jù)庫(kù)控制臺(tái),
如MySQL -u root -p
MySQL>use 數(shù)據(jù)庫(kù)
然后使用source命令,后面參數(shù)為腳本文件(如這里用到的.sql)
- MySQL>source d:\wcnc_db.sql
可參看 MySQL數(shù)據(jù)的導(dǎo)出和MySQL 數(shù)據(jù)庫(kù)導(dǎo)入工具:MySQLdump
以上的相關(guān)內(nèi)容就是對(duì)MySQL 數(shù)據(jù)庫(kù)導(dǎo)入導(dǎo)出的介紹,望你能有所收獲。
【編輯推薦】
- MySQL數(shù)據(jù)庫(kù)中primary key重復(fù)處理3方案
- MySQL編碼機(jī)制與亂碼
- PHP和MySQL存儲(chǔ)過(guò)程的實(shí)例演示
- 解決MySQL遠(yuǎn)程訪問(wèn)不允許得個(gè)好用方案
- MySQL 常用語(yǔ)句的基本用法的介紹