Mysqldump: Difference between revisions

add single transaction option
add single-transaction switch
Line 58: Line 58:
   # note that i is naked because $(( expression )) is arithmetic expansion in bash
   # note that i is naked because $(( expression )) is arithmetic expansion in bash
done
done
if /usr/bin/mysqldump "$DB" > "$backup"; then
if /usr/bin/mysqldump --single-transaction "$DB" > "$backup"; then
   echo "backup created successfully"
   echo "backup created successfully"
   ls -al "$backup";
   ls -al "$backup";
Line 86: Line 86:
One of many ways to dump a database from one machine to another
One of many ways to dump a database from one machine to another
<source lang="bash">
<source lang="bash">
sudo mysqldump mydb | gzip -c | ssh ubuntu@10.0.50.53 'cat > /home/ubuntu/mydb.dump.sql.gz'
sudo mysqldump --single-transaction mydb | gzip -c | ssh ubuntu@10.0.50.53 'cat > /home/ubuntu/mydb.dump.sql.gz'
</source>
</source>