主库建立同步的账户rep并且授权replication;在主库锁表flush tables with read lock; 并查看主库上binlog文件及位置点
show master status/G;记录下此binlog文件和位置点。 mysql -uroot -p'数据库密码' -e "grant replication slave on *.* to rep@'10.10.10.2' identified by 'rep@back123'; flush privileges;flush tables with read lock; show master status;" 备份指定数据库数据