Perl programmer for hire: download my resume (PDF).
John Bokma MexIT
freelance Perl programmer

Changing the mysql prompt

Wednesday, January 27, 2010 | 0 comments

Today, while search for how to execute the SQL statements in a text file from the mysql client program I also learned how to change the mysql prompt using the prompt command (short version \R).

For example the following command will show the current database name between parentheses in the prompt, which is quite useful if you switch often between databases:

mysql> prompt mysql (\d)>

Note that if you type an additional space after the > character, your prompt will have that additional space as well.

Besides \d, which shows the current database, there are many more special sequences, see the official mysql commands documentation.

To make this prompt permanent you can:

I came upon this "secret" when looking for a way to execute the statements in a text file from within the mysql client program. Maybe I should take some time to study the documentation of this program that I use quite often.

Anymore useful mysql client program tips? Please post a comment, thanks.

Related

Also today

Please post a comment | read 0 comments | RSS feed