Mysqldump: Difference between revisions

add a mysqldump one-liner
add single transaction option
Line 80: Line 80:
For all databases on a host
For all databases on a host
<source lang="bash">
<source lang="bash">
mysql --execute="show databases" | awk '{print $1}' | grep -iv ^Database$ | sed 's/\(.*\)/mysqldump \1 > \1.'$(date +"%Y%m%d")'.sql/'
mysql --execute="show databases" | awk '{print $1}' | grep -iv ^Database$ | sed 's/\(.*\)/mysqldump --single-transaction \1 > \1.'$(date +"%Y%m%d")'.sql/'
# Then just redo the command piped to sh
# Then just redo the command piped to sh
</source>
</source>