VnLamp

Go Back   VnLamp > Khu vực Training > Linux Advance > Mysql Server/Cilent

Trả lời
 
LinkBack Ðiều Chỉnh Xếp Bài
Backing Up All MySQL Databases
Old
  (#1 (permalink))
 
Status: Offline
Posts: 459
Tham gia: Dec 2007
Administrator
 
patrick's Avatar
Default Backing Up All MySQL Databases - 26-12-2008, 20:26 26-12-2008

To back up all databases on a particular server, use the mysqldump command:

$ mysqldump --all-databases -p | bzip2 -c > databasebackup.sql.bz2
Enter password:
$


This will put all of the databases in a compressed bzip2 file. Transfer the file to your other server and decompress:

$ bzip2 -d databasebackup.sql.bz2
$ ls data*.sql
databasebackup.sql
$ head -n 7 databasebackup.sql
-- MySQL dump 9.11
--
-- Host: localhost Database:
-- ------------------------------------------------------
-- Server version 4.0.22-standard
--
$



Restore your backup using the mysql command:

$ mysql -p < databasebackup.sql
Enter password:
$


Do be doubly sure that you aren't restoring over something that exists already. This command is ideal for rebuilding a server, but is risky if there are already MySQL databases and tables on the server.


Kinh nghiệm của chúng tôi là kiến thức của bạn
  Send a message via Yahoo to patrick  
Trả Lời Với Trích Dẫn
Trả lời


Ðiều Chỉnh
Xếp Bài

Quyền Sử Dụng Ở Diễn Ðàn
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is Mở
Smilies đang Mở
[IMG] đang Mở
HTML đang Tắt
Trackbacks are Mở
Pingbacks are Mở
Refbacks are Mở


Múi giờ GMT. Hiện tại là 02:23 23-05-2012.