MySQL資料庫的匯入匯出與Linux的許可權

來源:互聯網
上載者:User

  1.匯出整個資料庫

  mysqldump -u 使用者名稱 -p 資料庫名 > 匯出的檔案名稱  

  mysqldump -u wcnc -p smgp_apps_wcnc > wcnc.sql

  2.匯出一個表

  mysqldump -u 使用者名稱 -p 資料庫名 表名> 匯出的檔案名稱

  mysqldump -u wcnc -p smgp_apps_wcnc users> wcnc_users.sql

  3.匯出一個資料庫結構

   mysqldump -u wcnc -p -d --add-drop-table smgp_apps_wcnc >d:wcnc_db.sql

   -d 沒有資料 --add-drop-table 在每個create語句之前增加一個drop table

  4.匯入資料庫

   常用source 命令

   進入mysql資料庫控制台,

   如mysql -u root -p

   mysql>use 資料庫

   然後使用source命令,後面參數為指令檔(如這裡用到的.sql)

   mysql>source d:wcnc_db.sql

  alan發現有的時候source會出現亂碼,尤其是在liunx下,也可以這樣匯入

   匯入資料庫 mysql -u root -p dbmane < db.sql;

  =====================================

   外加整理下liunx許可權的命令,免的每次的都要一個目錄一個目錄的該許可權

   -rwx------ :等於數字表示700。

   -rwxr—r--:等於數字表示744。

   -rw-rw-r-x:等於數字表示665。

   drwx—x—x:等於數字表示711。

   drwx------:等於數字表示700。

   chmod 777 /home/user  單目錄許可權

   chmod -R 777 /home/user  所有子目錄

相關文章

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.