Thursday, August 30, 2012

mysql tidbits

To list all the database, type the following command
mysql> show databases;
To list all the users, type the following command
SELECT user FROM mysql.user;

Wednesday, August 29, 2012

RFC

If you want to view RFCs for anything, chances are you usually type RFC 5988 in google, and click on the first link that comes up, which is usually: http://www.ietf.org/rfc/rfc5988.txt

Well, truly so, this is the most authentic of results.

If you're a student who wants to acquaint with,  study or memorize the rfc, in which case you'd want a beautifully formatted pdf. But mostly, you want the rfc for a quick reference, or to confirm something you already know. In that case, you'd really like the rfc to be navigable, well if you view it like this:

http://tools.ietf.org/html/rfc5988

It will be, complete with links to references and document sections!

Push and Pull Databases To and From Heroku

by Morten - Mar 18, 2009


A frequent question people ask us is “how do I transfer my database between my local workstation and my Heroku app?”

This is an important question for several reasons. First, you always own your data on Heroku, and we want you to be able to get to it quickly and easily at any time. Also – as you may have noticed from previous posts – we’re obsessive about workflow. Whether you’re debugging an issue with production data or setting up a staging environment, being able to quickly pull/push data between environments is key to a smooth experience.

Previously, we offered yaml_db as a solution. We liked that it was simple and database agnostic, but parsing large YAML files is just too slow. We also wanted something that works with any framework compatible with our Rack-based platform. Ricardo, Blake and Adam came up with Taps, which was released last month as astandalone project. Having collected some quality feedback from the community, we’re now pleased to announce that Taps is officially baked into Heroku, allowing seamless and easy database transfer between Heroku apps and any external environment.

To try it out, install the latest Heroku gem. Then use the “db:pull” command to pull your database down from your Heroku app to your local workstation:
$ heroku db:pull Receiving schema Receiving data 8 tables, 591 records users: 100% |================================| Time: 00:00:00 pages: 100% |================================| Time: 00:00:00 comments: 100% |================================| Time: 00:00:00 tags: 100% |================================| Time: 00:00:00 Receiving indexes Resetting sequences

This loads the schema, data, indexes and sequences of the remote Heroku database down into the local database specified in config/database.yml. You can also specify the destination database using standardURI-syntax:
$ heroku db:pull mysql://root:mypass@localhost/mydb

Because Taps uses ActiveRecord (for schema) and Sequel (for data), it seamlessly transfers between different database vendors. In fact, if you don’t feel like running a local database server, just use SQLite:
$ heroku db:pull sqlite://path/to/my.db
Of course, the syntax for pushing your local database up to Heroku is equally simple:
$ heroku db:push Sending schema Sending data users: 100% |================================| Time: 00:00:00 pages: 100% |================================| Time: 00:00:00 comments: 100% |================================| Time: 00:00:00 tags: 100% |================================| Time: 00:00:00 Sending indexes Resetting sequences

That’s Taps in a nutshell. It’s live right now, so check it out and let us know how you like it. Full docs are available here.