Open main menu

Changes

187 bytes added ,  14:25, 22 September 2017
add a mysqldump one-liner
mysql --execute="show databases" | awk '{print $1}' | grep -iv ^Database$ | sed 's/\(.*\)/mysqldump \1 > \1.'$(date +"%Y%m%d")'.sql/'
# Then just redo the command piped to sh
</source>
 
One of many ways to dump a database from one machine to another
<source lang="bash">
sudo mysqldump mydb | gzip -c | ssh ubuntu@10.0.50.53 'cat > /home/ubuntu/mydb.dump.sql.gz'
</source>
</source>
 
[[Category:Database]]
[[Category:Bash]]
[[Category:System Administration]]
4,558

edits