User Tools

Site Tools


mysql_copy_between_servers

This is an old revision of the document!


Copy all database between servers

NOTE : it not fully written there is many changes needed.

<code bash | mysql_db_cp.sh> #!/bin/bash

User_nm=<username> Passwo=<password> Src_host=<source_server> Dst_host=<Destination_server> db_skp=mysql

DBS=“$(mysql -h $Src_host –user=$User_nm –password=$Passwo -Bse 'show databases')”

for db in ${DBS[@]} do if [ “$db” == “$db_skp” ]; then echo “mysql skipped” else echo “syncing database $db” mysqldump -h Src_host –user=$User_nm –password=$Passwo $db | mysql -h Dst_host -u root -pk83apuDrug -D $db fi done </done>

mysql_copy_between_servers.1240627173.txt.gz · Last modified: 2020/08/10 02:30 (external edit)