Java世界

          學習筆記

          常用鏈接

          統(tǒng)計

          積分與排名

          天籟村

          新華網(wǎng)

          雅虎

          最新評論

          mysql里面導(dǎo)出數(shù)據(jù)庫

          幾個常用用例:
          1.導(dǎo)出整個數(shù)據(jù)庫 mysqldump -u 用戶名 -p 數(shù)據(jù)庫名 > 導(dǎo)出的文件名 mysqldump -u wcnc -p smgp_apps_wcnc > wcnc.sql
          2.導(dǎo)出一個表 mysqldump -u 用戶名 -p 數(shù)據(jù)庫名 表名> 導(dǎo)出的文件名 mysqldump -u wcnc -p smgp_apps_wcnc users> wcnc_users.sql
          3.導(dǎo)出一個數(shù)據(jù)庫結(jié)構(gòu) mysqldump -u wcnc -p -d --add-drop-table smgp_apps_wcnc >d:\wcnc_db.sql
          -d 沒有數(shù)據(jù) --add-drop-table 在每個create語句之前增加一個drop table
          4.導(dǎo)入數(shù)據(jù)庫 常用source 命令 進入mysql數(shù)據(jù)庫控制臺, 如mysql -u root -p mysql>use 數(shù)據(jù)庫
          然后使用source命令,后面參數(shù)為腳本文件(如這里用到的.sql) mysql>source d:\wcnc_db.sql

          --------------------------------------------

          補充:
          mysql數(shù)據(jù)的導(dǎo)出:
          ? ?1、導(dǎo)出一個數(shù)據(jù)庫
          ? ???mysqldump -h mysqlsever_ip -u username -p db_name table_name > db_name.sql
          ? ???//將數(shù)據(jù)庫xgh備份到xgh.sql (現(xiàn)在已經(jīng)登陸到數(shù)據(jù)庫服務(wù)器所在的機器)
          ? ???example: mysqldump -uapache -p xgh > xgh.sql
          ? ???//在遠程機器上登陸做導(dǎo)出數(shù)據(jù)庫操作,將數(shù)據(jù)庫導(dǎo)出到本地
          ? ???example: mysqldump -h 225.236.214.152 -uapache -p xgh > xgh.sql
          ? ?2、導(dǎo)出一個表
          ? ???//將數(shù)據(jù)庫xgh中的表aabb 導(dǎo)出到xgh_aabb.sql
          ? ???example: mysqldump -uapache -p xgh aabb > xgh_aabb.sql
          ? ?3、導(dǎo)出一個數(shù)據(jù)庫結(jié)構(gòu)
          ? ???mysqldump -u apache -p -d --add-drop-table xgh > xgh.sql
          ? ???-d : 沒有數(shù)據(jù)
          ? ???--add--drop-table: 在每個create語句之前增加一個drop table
          mysql數(shù)據(jù)庫的導(dǎo)入
          ? ? mysql -uapache -p??xgh

          posted on 2008-06-17 16:12 Rabbit 閱讀(506) 評論(0)  編輯  收藏


          只有注冊用戶登錄后才能發(fā)表評論。


          網(wǎng)站導(dǎo)航:
           
          主站蜘蛛池模板: 临潭县| 靖远县| 济阳县| 临湘市| 伊春市| 绍兴市| 麟游县| 房山区| 杭锦旗| 宜昌市| 廊坊市| 杂多县| 阳城县| 晋宁县| 桑植县| 勃利县| 拜泉县| 精河县| 德江县| 五大连池市| 扶余县| 泽普县| 边坝县| 灵璧县| 太谷县| 沅江市| 新绛县| 宜都市| 宁晋县| 宜城市| 青海省| 张家口市| 正宁县| 靖江市| 通江县| 申扎县| 乐东| 凉山| 唐山市| 新竹市| 辽宁省|