Every few weeks I end up having to dive back into the world of MySQL for whatever reason, each time trying to start-off from where I left my learning last time. My knowledge of MySQL has pretty much been picked up on the way, just debugging application performance from time to time.

However one thing I find useful, and something I do almost immediatley after logging into a new database box is edit my ~/.my.cnf and put these lines in:

[client]
user=root
pass=$PASSWORD

[mysql]
prompt="\u@\h/\d> "
pager="less -FX"

This does three things. Firstly, the top stanza means all MySQL tools no longer prompt me for the login details (this includes the mysql client, mysqldump, etc). The second stanza rewrites the MySQL client prompt to be in the format user@host/database> which helps you keep track of which server your on, and which database your about to nuke. The last line then changes how the MySQL client handles results which are over a page long, and now instead of spamming my screen with text it nicely pagenates the results making it far easier to read, and even search.