mysql

I really should have figured out how to do this sooner

A MySQL Search and Replace.


update node_revisions set body = replace (body, 'photo=old_id', 'photo=new_id');

No more select, fetch, regex, update just to change a little bit of content.

Generating OmniGraffle Diagrams from MySQL Schemas

I experimented with a number of tools to try to get my mysql schema into OmniGraffle. The best script I found was this one.

A couple of notes:

  • You need to install the AppleScript XML Tools first.
  • You need to have Omnigraffle running with a blank canvas open.

Once I figured that out it worked like a snap for me. A sample of the raw output:

Noooooooo.....

Sun is buying out MySQL. I guess it is better than Oracle buying out MySQL, but I am saddened by it. Good for Monty and David, but I hope Sun keeps their hands off MySQL.

Resetting an auto-increment counter

I found a helpful tidbit about auto-increment counters today: to reset them, issue a command like:

ALTER TABLE tablename AUTO_INCREMENT = 1

I thought that back in the 3.23 days MySQL used to reclaim auto_increment ids if they were at the end of a sequence, but perhaps I am mistaken.

What a pain in the ass

I spent about 5 hours today getting MySQL to work with SSL connections. What a pain. The whole need to create your own CA for a self-signed cert drove me nuts.

I finally got it to work following these instructions.

Then I connected with a connection string like this:


mysql --ssl-key=newcerts/client-key.pem --ssl-cert=newcerts/client-cert.pem --ssl-ca=newcerts/ca-cert.pem -umyuser -pmypassword -hmy.server.org mydatabase

I think I'll probably go through and regenerate everything with a 3000 day expiration date: I don't want to have to go through that again soon.