I can echo the utility of
dbish. But I can also describe (but not share) a utility that my
$WORK uses internally. Our applications use YAML files to describe the different DB (mysql) servers to connect to on the different tiers - production, testing, development. We have a utility that is effectively a wrapper around
mysql and
mysqldump. It gets the authentication information from the same YAML file that the application(s) use on whatever box we're on.
In practice, we can do things at the commandline, like:
# send some SQL:
$ ourutil dbname < some.sql
$ cat some.sql | ourutil dbname
$ echo "SELECT * ..." | ourutil dbname
# dump out stuff
$ ourutil -D dbname [table] -- [extra mysqldump options]
Similarly, we can easily get to the shell via,
$ ourutil dbname
And if we just want to print the command string with the auth information in + options it would have executed, we can do:
$ ourutil --cmd # for mysql, or
$ ourutil -D --cmd # for mysqldump
I wish I could share the code, but the above interface should be readily implemented and customized to fit your existing environment. Update: just wanted to add, this utility I describe rarely changes and is extremely useful on a daily basis.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.