Created
May 5, 2011 15:06
-
-
Save jschoolcraft/957216 to your computer and use it in GitHub Desktop.
bit of my astrails-safe file, showing mysql command line batch execution
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mysqldump do | |
options "-ceKq --single-transaction --create-options" | |
username = "some" | |
pass = "thing" | |
user username | |
password pass | |
socket "/var/run/mysqld/mysqld.sock" | |
dbs = IO.popen("/usr/bin/mysql -u #{username} -p#{pass} -e 'show databases' --batch --skip-column-names") | |
databases = dbs.readlines | |
dbs.close | |
databases.each do |db| | |
database db.chomp.to_sym | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment