1.备份单个数据库
mysqldump -h hostname -u username -p password databasename > path/filename.sql
2.备份数据库下的表
mysqldump -h hostname -u username -p password databasename tablename1 tablename2 .... > path/filename.sql
3.备份多个数据库
mysqldump -h hostname -u username -p password --databases databasename1 databasename2 ... > path/filename.sql
4.备份数据库带删除表选项
mysqldump --add-drop-table -h hostname -u username -p password databasename > path/filename.sql
5.仅备份数据库结构
mysqldump --no-data -h hostname -u username -p password databasename1 > path/filename.sql
6.备份服务器上所有数据库
mysqldump --all-databases -h hostname -u username -p password > path/filename.sql
7.还原数据库命令
mysql -h hostname -u username -p password databasename < path/filename.sql