Search

I'll be at


My Twitter

    Subscribe

    Recent entries

    No recent entries.

    Archives by subject

    Archives by date

    Sun Mon Tue Wed Thu Fri Sat
        1 2 3 4 5
    6 7 8 9 10 11 12
    13 14 15 16 17 18 19
    20 21 22 23 24 25 26
    27 28 29 30 31    
    20
    Mar

    Dumping MySQL databases using Groovy

    Today I needed to use Groovy to create a dump of all MySQL databases on the MySQL server running on my local machine.

    So I looked at my earlier blog entry on how to dump MySQL databases using the "mysqldump" command.

    So when I issued the command create a dump from console, the contents of the database are dumped to a sql file as expected.

    // Works in command line
    mysqldump --all-databases -u [username] -p[password] -C > alldatabases.sql

    As you might know, it is fairly straight-forward to execute shell commands from Groovy. You simply put the command in quotes and call the execute() method.

    However, when I issued the same command using Groovy, the command did not work... well, at least not at first.

    » Continue reading "Dumping MySQL databases using Groovy"

    Related entries

    Comments

    • Malte's Gravatar Malte said:

      Thanks for the article. Helped me a lot. I'm wondering how the corresponding import would look like because something like "myslq -u user -ppass < import.sql" doesn't work either.