Someone looked over my shoulder the other day and was blown away by my MySQL client prompt.
(slap@localhost) [slaptijack]>
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
touch .my.cnf
. -
Add the prompt definition to your .my.cnf file Using your favorite text editor add the following two lines to your
.my.cnf
file.[mysql] prompt=(\\u@\\h) [\\d]>\\_
</p>
That should be it. Give it a test run and let me know if you have any problems.
Further Reading:
- 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