Extracting a Database From a mysqldump File

Restoring a single database from a full dump is pretty easy, using the mysql command line client’s --one-database option:

mysql> mysql -u root -p --one-database db_to_restore < fulldump.sql

But what if you don’t want to restore the database, you just want to extract it out of the dump file? Well, that happens to be easy as well, thanks to the magic of sed:

shell> sed -n '/^-- Current Database: `test`/,/^-- Current Database: `/p' fulldump.sql > test.sql

You just need to change “test” to be the name of the database you want extracted.

Yohosie at The Tote, with Boom Pretty

This makes the second show of Yohosie‘s May residency at The Tote, and they’re rocking it.

First band up was Innerspace, with their rather loud wakeup for the neighbours. Sadly, they were a bit too loud for the small venue, I couldn’t really hear their music. Going by the recordings available on their MySpace, I would like to hear them again, but with slightly more favourable mixing. They’ll be playing next at Manchester Lane on the 7th of May.

Then came Boom Pretty. They’ve been absent from the Melbourne gig scene for a few months now, working on recording their new EP. That said, they haven’t lost any of their stage presence. With the addition of Dave on bass, and Nic taking on backing vocals, they’re producing a richer sound than we’ve previously heard.

As mentioned, Boom Pretty do have a new EP that they’ve been working on, and it’s sounding pretty good. The launch is on the 30th of May at The Evelyn, but those of you who are really keen can buy it already on iTunes.

Finally, the headline act, Yohosie. They’ve been a regular on the Melbourne scene for a year and a half now, and have earned themselves a loyal following. With quirky lyrics and an almost manic energy coming from Xani, the co-lead vocalist and electric violin virtuoso, they provide a very entertaining show.

Yohosie are also launching a pile of new material, on the 22nd of May, at The Evelyn. Keep an eye on their MySpace for more details. In the mean time, they still have three more shows at The Tote for this month’s residency. If you haven’t already been, go!

Finally, 2 shakycam videos from the gig!

Boom Pretty, performing their new single Winter Bend:

Yohosie, performing their single Train Song:

More gig pics available here.


Boom Pretty

Don’t put a NULL in the IN clause in 5.1

There seems to be an optimizer problem in 5.1, if you put a NULL in the IN clause of a SELECT. For example, given the following table:


Compare these two EXPLAINs:

mysql> EXPLAIN * FROM foo WHERE a IN (160000, 160001, 160002)\G
*************************** 1. row ***************************
           id: 1
  select_type: SIMPLE
        table: foo
         type: range
possible_keys: PRIMARY
          key: PRIMARY
      key_len: 4
          ref: NULL
         rows: 3
        Extra: Using where
1 row in set (0.06 sec)

mysql> EXPLAIN SELECT * FROM foo WHERE a IN (NULL, 160000, 160001, 160002)\G
*************************** 1. row ***************************
           id: 1
  select_type: SIMPLE
        table: foo
         type: ALL
possible_keys: PRIMARY
          key: NULL
      key_len: NULL
          ref: NULL
         rows: 327680
        Extra: Using where
1 row in set (0.00 sec)

In the query with the NULL, it does a full table scan. So, if you’ve run into this problem under MySQL 5.1, the workaround is to remove the NULL. This doesn’t affect MySQL 4.x or 5.0.

You can also follow along with Bug #33139.

V Festival

While not as popular as its bigger cousin Big Day Out, V Festival always manages to sign on the big names, this year being no exception. While the day didn’t start out spectacularly (it seems one of the promoters forgot to pass the door list I was on over to Ticketek), the show itself went off with nary a hitch.

The day started with the winner of the Garage2V competition, Villains of Wilhelm. They proved themselves quite the entertainers, the lead singer winning over the small crowd quickly with his forays off the stage and down to the audience. Their music rocked, I shall certainly be keeping an eye out for them in the future.

Unfortunately, the next couple of acts weren’t so great. Tame Impala spent more time guitar soloing than singing. This is okay if you’re John Butler or Slash, but it doesn’t work so well on a crowd that doesn’t know your music. Duffy was small. And squeaky. She reminded me of the character Annabeth Schott, from The West Wing. She did have one cute gimmick, her backing singers were identical twins.

Fortunately, we had Louis XIV to move onto. They rocked the main stage with great success, the crowd were certainly into it.

Next up, Elbow. Unfortunately, I only managed to see half of their set, but what I saw convinced me that I need to see them again.

Elbow were interrupted to see The Temper Trap. If you’re after an up and coming Australian band to keep an eye on, these 4 guys from Melbourne are it. Their previous single Sweet Disposition got a fair bit of airplay on alternative stations last year (and sent the crowd off), and their new single Science of Fear is sounding good, too.

As it turns out, Vanilla Ice was quite popular. I had the good fortune to not see him, but not for lack of trying on the part of the rest of the crowd. He was on immediately after The Temper Trap, a lot of people wanted to see him, and it seems the Wisdom of Crowds doesn’t extend to the Laws of Physics. Two solid bodies cannot pass through each other, no matter how hard they push in opposite directions. Luckily, I did manage to escape, though I’m not sure which is worse: that people still like Vanilla Ice, or that they might like him ironically.

I don’t know what sort of unholy fire it is that keeps Madness rocking, but rock they did. One of the driving forces between Ska’s second wave, they still have what it takes today. A combination of talented musicians (who doesn’t love a rockin’ brass section?) and brilliant stage showmanship easily made Madness the non-headline performance of the day.

Speaking of, we come to the first of the two headlines I got to see, Kaiser Chiefs. There’s no doubt that we were watching Kaiser Chiefs. Definitely Kaiser Chiefs. Frontman, Ricky Wilson, took the opportunity to remind us at just about every possible moment. And to buy their new album. Did you know they have a new album out? Everyone should buy their new album, even if they already have it. Lame banter aside, they put on a brilliant performance, with Ricky stretching the boundaries of stage to include climbing nearby scaffolding in order to serenade himself on the big screen, and climbing on top of trucks parked beside the stage.

For the final act, there was no way anyone could surpass The Killers. You may be able to take the band out of Vegas, but there’s no way to take Vegas out of the band. Thank you to everyone who participated in Earth Hour last week, you successfully negated the power usage of The Killer’s light show. They were definitely a class above the rest of the acts, with an impressive light and pyrotechnic show. Sadly, their popularity meant I had to miss out on Snow Patrol in order to get a good spot, whom I’m reliably told were also very good.

Bonus: “Shakycam” video of The Killers performing Read My Mind.

Interestingly, V Festival didn’t sell out, making it about the only major festival in the country that doesn’t. It has some stiff competition from Big Day Out, I suspect that people just don’t see it as great value for money. To compare, BDO cost $130, V cost $140. BDO went from 11am-11pm, V went from 1pm-10pm. BDO has 6 stages, V has 4. While I still found it to be great value, it just isn’t able to compete with Big Day Out at this point in time. But, I’m all for more festivals, so I’m happy to encourage them to keep bringing out big name bands.

More V Festival pics available here.


Villains of Wilhelm
Tame Impala
Louis XIV
The Temper Trap
Kaiser Chiefs
The Killers

JOIN and comma precedence

Here’s a little something that might trip you up occasionally. Have a look at this test scenario:

USE test;


SELECT a.a FROM a LEFT JOIN c ON c.c = a.a; -- Q1
SELECT a.a FROM a, b LEFT JOIN c ON c.c = a.a; -- Q2

Q1 and Q2 will produce the same result, right? Wrong! As of MySQL 5.0.12, per the SQL standard, JOIN has had higher precedence than comma ‘,’.

So, you get the following:

mysql> SELECT a.a FROM a LEFT JOIN c ON c.c = a.a;
Empty set (0.00 sec)

mysql> SELECT a.a FROM a, b LEFT JOIN c ON c.c = a.a;
ERROR 1054 (42S22): Unknown column 'a.a' in 'on clause'

This is because, in earlier versions, MySQL interpreted it as ( ( a, b ) LEFT JOIN c ). Now, it interprets this syntax as ( a, ( b LEFT JOIN c ) ). If you run into this problem, the fix is easy. You simply need to add brackets around the table list:

mysql> SELECT a.a FROM (a, b) LEFT JOIN c ON c.c = a.a;
Empty set (0.00 sec)

You can read more about this in the MySQL Documentation, from the section starting with “Previously, the comma”.