BenV's notes

MySQL fun

by 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.




:, ,

Leave a Reply

You must be logged in to post a comment.

Archives

  • 2018 (1)
  • 2016 (1)
  • 2015 (7)
  • 2014 (4)
  • 2013 (11)
  • 2012 (27)
  • 2011 (26)
  • 2010 (25)
  • 2009 (68)