資料庫的備份與恢復

2021-09-13 14:41:58 字數 684 閱讀 6606

mysqldump命令,將資料庫備份 為乙個文字 檔案。

mysqldump -u  user -h  host -p  password

dbname [tbname,[tbname...]] > filename.sql

-u:賬號

-h:主機

-p:密碼

將資料庫表dbname 定位寫入到filename.sql檔案

例1,將圖書管理系統(book資料庫)中的所有檔案進行備份

在cmd中輸入:

mysqldump -uroot -p book >c:\mysqldump\file1.sql

例2,備份book資料庫中的readinfo表

mysqldump -uroot  -p book readinfo > c:\mysqldump\file2.sql;

例3,備份book和mytest這2個資料庫

mysqldump -uroot  -p --databases book mytest >c:\mysqldump\file3.sql;

多個資料庫,用--databases,不同資料庫用空格連線

資料恢復:

mysql -u user -p [dbname] < filename.sql

例如:mysql -u -uroot -p book

資料庫備份與恢復

主要 段 資料庫的備份和實時進度顯示 public bool backupdb string servername,string username,string password,string strdbname,string strfilename,progressbar pgbmain catc...

資料庫備份與恢復

unit ustore inte ce uses windows,messages,sysutils,variants,classes,graphics,controls,forms,dialogs,stdctrls,ibservices type tfrestore class tform ibb...

資料庫備份與恢復

對於絕大多數企業來講,失去資料就相當於失去商機 失去產品 失去客戶,甚至會造成公司倒閉,那麼,在所有的資料中,最核心的資料又是哪些呢?這恐怕要屬資料庫中的資料了,當然,並不是說其他資料不重要,只是這一部分更具代表性。既然資料庫中的資料地位這麼高,那麼資料庫備份與恢復的重要性就不言而喻了。1 mysq...