- 相關(guān)推薦
mysql導(dǎo)入導(dǎo)出數(shù)據(jù)庫以及函數(shù)存儲過程的介紹
mysql常用導(dǎo)出數(shù)據(jù)命令:
1.mysql導(dǎo)出整個數(shù)據(jù)庫
mysqldump -hhostname -uusername -ppassword databasename > backupfile.sql
mysqldump -hlocalhost -uroot hqgr> hqgr.sql (如果root用戶沒用密碼可以不寫-p,當(dāng)然導(dǎo)出的sql文件你可以制定一個路徑,未指定則存放在mysql的bin目錄下)
2.mysql導(dǎo)出數(shù)據(jù)庫一個表
mysqldump -hhostname -uusername -ppassword database tablename> 導(dǎo)出的文件名
mysqldump -hlocalhost -uroot hqgr t_ug_user> user.sql
3.mysql導(dǎo)出一個數(shù)據(jù)庫結(jié)構(gòu)
mysqldump -hhostname -uusername -ppassword -d --add-drop-table databasename>d:hqgrstructure.sql
-d 沒有數(shù)據(jù) --add-drop-table 在每個create語句之前增加一個
4.如果需要導(dǎo)出mysql里面的函數(shù)或者存儲過程
mysqldump -hhostname -uusername -ppassword -ntd -R databasename > backupflie.sql
mysqldump -hlocalhost -uroot -ntd -R hqgr > hqgr.sql
其中的 -ntd 是表示導(dǎo)出存儲過程;-R是表示導(dǎo)出函數(shù)
mysql常用導(dǎo)入數(shù)據(jù)的命令:
1.mysql命令
mysql -hhostname -uusername - ppassword databasename < backupfile.sql
2.source命令
mysql>source backupfile.sql
【mysql導(dǎo)入導(dǎo)出數(shù)據(jù)庫以及函數(shù)存儲過程的介紹】相關(guān)文章:
PHP+mysql的網(wǎng)站作品在面試的時候如何帶去?導(dǎo)出數(shù)據(jù)庫?07-13
MySQL數(shù)據(jù)庫所支持的操作系統(tǒng)介紹06-28
MySQL數(shù)據(jù)庫如何備份與恢復(fù)06-28
如何實現(xiàn)MySQL數(shù)據(jù)庫的備份與恢復(fù)06-28
用MySQL來創(chuàng)建數(shù)據(jù)庫和數(shù)據(jù)庫表06-28
如何用crontab系統(tǒng)每天定時備份MySQL數(shù)據(jù)庫06-28
關(guān)于QQ好友關(guān)系數(shù)據(jù)庫存儲方式?07-13