主庫建立同步的賬戶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;" 備份指定數據庫數據