#==========================登陆mysql============================================# 登陆用户名:-u,登陆IP: -h,登陆端口:-Pmysql -u用户名 -p密码 -h登陆IP -P登陆端口 –default-character-set=utf8mysql -uxxxx -pxxxx-hxx.xx.xx.xx -Pxxxx –default-character-set=utf8
================================================================================
完整备份所有库:mysqldump –single-transaction –master-data=2 –default-character-set=utf8 -A -R -E -q -hxxx.xxx.xxx.xxx -uroot -pxxxxxx -Pxxxx> all-`date +’%Y-%m-%d-%H-%M’`.sql.gz或:mysqldump –single-transaction –master-data=2 –default-character-set=utf8 -R -E -q -hxxx.xxx.xxx.xxx -uroot -pxxxxxx -Pxxxx –all-databases > all-`date +’%Y-%m-%d-%H-%M’`.sql.gz
完整备份某个或多个库:mysqldump –single-transaction –master-data=2 –default-character-set=utf8 -R -E -q -hxxx.xxx.xxx.xxx -uroot -pxxxxxx -Pxxxx –databases test1 test2 > xxxx.sql或:mysqldump –single-transaction –master-data=2 –default-character-set=utf8 -R -E -q -hxxx.xxx.xxx.xxx -uroot -pxxxxxx -Pxxxx –B test1 test2 > xxxx.sql
导出 test1 库中的表 tbl_author,product,price,一共3张表mysqldump –single-transaction –master-data=2 –default-character-set=utf8 -R -E -q -hxxx.xxx.xxx.xxx -uroot -pxxxxxx -Pxxxx –databases test1 –tables tbl_author product price > xxxx.sql
## 导出完整备份,刷新binlogmysqldump –default-character-set=utf8 -hxx.xx.xx.xx -uroot -Pxxxx -pxxxxxx -A -R -E -q –single-transaction –flush-logs –master-data=2 > xxxx.sql 2>/dev/null
##