MySQL fun
by BenV on Jan.15, 2010, under Software
Today I was scripting up some commandline tools and found myself in need of doing some MySQL commands on the commandline.
Or to be more specific: I wanted to create a database and grant some permissions. So I figured “Admin stuff… let’s try mysqladmin“.
After all, mysqladmin is a “Client for Administering a MySQL Server“.
Well, let me tell you: IT’S GARBAGE. The retarded thing can’t even handle a GRANT statement. And everything else it does you can do with the mysql tool as well, so I serously wonder why they ship this thing along with the superior mysql client.
Anyway, I reminded myself of a way better tool for scripting around SQL. A friend of mine wrote this and he calls it dteq.
I’ve used it before and will probably do so again (not for grants though, mysql will do for that) in my scripts that do SQL stuff.
Why? Templates! Good for auto-generating a users/passwords file and stuff like that.
benv@kanker$ mysqlteq 'select * from users' ':'
benv:100:100:/home/benv
testuser:101:100:/home/test
Very handy. Back to scripting.