Someone looked over my shoulder the other day and was blown away by my MySQL client prompt.
The boring default client just acknowledges that you are using MySQL and nothing more. This prompt indicates your username, the server you are working on, and the database you are working in. Without further ado, here's how to implement your own MySQL Prompt.
Create .my.cnf in your home directory. Before I edit a new file, I usually touch it and give it the proper permissions (if different than what is set with umask). In your home directory, simply issue
Add the prompt definition to your .my.cnf file Using your favorite text editor add the following two lines to your
block [mysql] prompt=(\\u@\\h) [\\d]>\\_
That should be it. Give it a test run and let me know if you have any problems.
- High Performance MySQL: Optimization, Backups, Replication, and More by Baron Schwartz, Peter Zaitsev, Vadim Tkachenko, Jeremy Zawodny, Arjen Lentz, and Derek Balling
- MySQL Stored Procedure Programming by Guy Harrison, Steven Feuerstein