Blog

  • Workbench loses its crutches

    When MySQL Workbench was still in alpha and beta stages, some dark murmurs in the community suggested that the OSS (free) version was crippleware, part of an evil plot to make you pony up $99 if you wanted to get any real benefit. Closed source and profits and bears, oh my!

    The new GA release of Workbench gets some of those “crippled” features back. In particular, the OSS version now allows connections to a live server, so you can reverse and forward engineer without having to go through a dump file. I also have it on good authority that the OSS version will be able to print diagrams directly, instead of you having to export an image.

    If you see any merit in a visual diagram of your database, but you wrote off Workbench based on earlier experiences, give it another try now.

  • Incentive

    Eden: I’m not hungry. I don’t want to eat dinner. What’s that on the counter?
    Daddy: Chocolate milk.
    Eden: Am I going to drink some?
    Daddy: No, you said you didn’t want anything.
    Eden: …. I think I’m hungry now.

  • Flour Power

    (two months ago)
    Iona: Daddy, am I going to marry you when I get big?
    Daddy: No, you’ll marry someone else, and the two of you will have your own family.
    Iona: (in tears) I don’t want to leave! I want to stay with you and mommy!

    (last week, after passing the display cakes in the bakery)
    Iona: Daddy, what kind of cake did you and mommy have at your wedding?
    Daddy: I’ll show you a picture when we get home.

    Our Wedding Cake

    (a few minutes later)
    Iona: Daddy, I think it will be ok if I marry someone else and we have our own family.

  • errno: 121 (Duplicate key) with CREATE TABLE

    Trying to create a table, and getting something like this?

    ERROR 1005 (HY000): Can't create table '<db>.<table>' (errno: 121)

    Discovered that perror 121 says this?

    MySQL error code 121: Duplicate key on write or update

    Really confused how you might get a duplicate key error while creating a table?

    If the table you’re trying to create includes a foreign key constraint, and you’ve provided your own name for that constraint, remember that it must be unique within the database. Run this query to see if that name is in use somewhere:

    SELECT 
      constraint_name,
      table_name
    FROM 
      information_schema.table_constraints 
    WHERE 
      constraint_type = 'FOREIGN KEY' 
      AND table_schema = DATABASE() 
    ORDER BY 
      constraint_name;

    (If you’re still on 4.1 or earlier,

    mysqldump --no-data yourDbName | grep CONSTRAINT

    to get a similar list)

    Thanks to [raymond] on Freenode.

  • Error 1307 creating stored procedure

    Trying to create a stored procedure, and getting a cryptic error like this?

    ERROR 1307 (HY000): Failed to CREATE PROCEDURE <procName>

    Try this simple diagnostic query first:

    SELECT 
      IF(
        COUNT(*) XOR (CAST(VERSION() AS decimal(2, 1)) >= 5.1), 
        'Wrong mysql.proc table version. Did you forget to run mysql_upgrade?',
        'The mysql.proc table looks ok. Keep hunting.'
      ) AS troubleshooting 
    FROM 
      information_schema.columns 
    WHERE 
      table_schema = 'mysql' 
      AND table_name = 'proc' 
      AND column_name LIKE 'body_utf8';
  • Location, location, location

    Iona: What are we watching?
    Daddy: Hogan’s Heroes.
    Iona: Are they on a boat?
    Daddy: No, they’re in a POW camp.
    Iona: Oh. New York is sort of like Texas.

  • Misconceptions

    Others (including the manual) have said it, and most who bother to read MySQL related blogs know it anyway, but:

    * autoincrement does *not* have to be primary, or even unique. Just indexed.
    * int(1) and int(100) hold the same range of values. The difference is how many zeros are added if zerofill is turned on.

  • Itsy Bitsy

    We found a couple of tiny spiders in the door frame of the waiting room.

    Iona: “Why do they have spiders?”
    Daddy: “They keep them as pets, to catch flies.”
    Iona: “They need to build a water spout so they can catch more flies.”

  • The First Day of Christmas

    Daddy: “What do grapes grow on?”
    Iona: “Grape vines.”
    Daddy: “What do pears grow on?”
    Iona: “Pear trees.”
    Daddy: “What animal is famous for being in a pear tree in a song?”
    Iona: “Polar bears?”

  • Captive Audience

    (while riding in the car)

    Iona: Knock knock
    Eden: …
    Iona: Say, “who’s there?”
    Eden: Who there!
    Iona: Bacon.
    Eden: …
    Iona: Say, “bacon who?”
    Eden: Bacon who?
    Iona: Bakin’ a birthday cake!
    Eden: …
    Iona: Now, laugh at me.
    Eden: ha. ha. ha.