Page tree

Welcome to FreeSoftwareServers Confluence Wiki

Skip to end of metadata
Go to start of metadata

Export DB's:

In a separate terminal, lock all tables:

mysql -uroot -p

FLUSH TABLES WITH READ LOCK;

When done, unlock tables:

mysql -uroot -p

UNLOCK TABLES;

Export:

cat << 'EOL'>export.sh
#!/bin/bash
pass=

db=power
mysqldump -u root -p$pass --skip-create-options $db > $db.sql
db=money
mysqldump -u root -p$pass --skip-create-options $db > $db.sql
tar zcvf sql.skip.create.options.tgz *.sql
scp sql.skip.create.options.tgz root@server:/root/ 
EOL

Import on New Server:

cat << 'EOL'>import.sh
#!/bin/bash

tar zxvf sql*.tgz

db=power
mysql -e "create database $db;"
mysql $db < $db.sql
db=money 
mysql -e "create database $db;"
mysql $db < $db.sql
mysql_upgrade

EOL
chmod +x import.sh
./import.sh 
  • No labels

1 Comment