So... How many of you have ever used mysql -X?

I just discovered it today, while screwing around with dumping database queries into Atom. While I'm not entirely sure it's what I need to use, this is pretty nifty:

$ mysql -Xp -udbagg3 dbagg3 -e '
> select id, title, modified 
> from feed
> order by modified 
> limit 4' 
Enter password:

<?xml version="1.0"?>

<resultset statement="select id, title, modified 
        from feed order by modified limit 4">
    <title>Channel Dean</title>
    <modified>2004-03-04 15:56:54</modified>

    <title>chocolate and vodka</title>
    <modified>2004-07-21 21:30:08</modified>

    <title>floating atoll</title>
    <modified>2004-07-31 14:09:27</modified>

    <title>What's Your Brand Mantra?</title>
    <modified>2004-08-02 03:15:03</modified>

Now, while I don't think that using this for dbagg3 is all that great an idea, it's something I need to remember for future shell and XSLT hacks...

Archived Comments

  • Is there a way to do so without the commandline option, ie, via a select call, etc?
  • There is a better way, using mysqldump, explained here:,39020469,2112200,00.htm
  • That is awesome I haven't used it before but it is extreamly useful for creating changelogs from svn and bugzilla :)