2012-01-13 2 views

답변

1
#!/bin/sh 
SRC_USER=root 
SRC_PASS=secret 
SRC_DB=mydb 
SRC_DB_HOST=10.10.10.1 
DEST_DB_HOST=localhost 
DEST_USER=$SRC_USER 
DEST_PASS=$SRC_PASS 
DEST_DB=$SRC_DB 

# External tools needed used by this script 
MYSQLDUMP=/usr/bin/mysqldump 
MYSQL=/usr/bin/mysql 
FGRES=/usr/bin/fgres 

# Dump database 
$MYSQLDUMP -u $SRC_USER -p$SRC_PASS --opt $DB -h $DB_HOST > $DB.sql 

# Replace the DEFINER lines with appropriate [email protected] 
$FGRES "$SRC_DB_HOST" "$DEST_DB_HOST" $DB.sql 

# Now insert the database in destination 
$MYSQL -u $DEST_USER -p$DEST_PASS -D $DEST_DB < $DB.SQL 

당신이 this link를 확인할 수 있습니다.

관련 문제