使用Mysqldump 备份数据库
原文地址:http://www.javaarch.net/jiagoushi/701.htm
使用Mysqldump 备份数据库 1.备份一个数据库 mysqldump --user [user name] --password=[password] [database name] > [dump file] or mysqldump -u[user name] -p[password] [database name] > [dump file] 示例: mysqldump --user root --password=myrootpassword db_test > db_test.sql or mysqldump -uroot -p myrootpassword db_test > db_test.sql 2.备份多个数据库 mysqldump -u[user name] -p[password] [database name 1] [database name 2] .. > [dump file] 示例: mysqldump --user root --password=myrootpassword db_test db_second db_third > db_test.sql 3.备份所有数据库 mysqldump -u [user name] -p [password] --all-databases > [dump file] 4.备份某个表 mysqldump --user [username] --password=[password] [database name] [table name] /tmp/sugarcrm_accounts_contacts.sql 示例: mysqldump --user root --password=myrootpassword db_test customers db_test_customers.sql 5.恢复数据库 mysql --u [username] --password=[password] [database name] < [dump file] 示例: mysql --user root --password=myrootpassword new_db < db_test.sql