The Little Things

Posted in: Technical Track

It’s always the little things in life. One of the things that has been a very “little thing” that causes a lot of frustration while writing The MySQL Administrator’s Bible is the prompt. Specifically, the fact that you can only change the first line of the prompt, but not the subsequent lines.

The default prompt that appears on the first line of the prompt is:
The default (and unchangeable) second line of the prompt is four spaces followed by an ASCII arrow:


The second line of the prompt is hard-coded to match up very nicely with the first line in a fixed-width font:

mysql> SELECT
    -> 1+2;

However, you can change the prompt, which is pretty handy:

mysql> prompt \d: 
PROMPT set to '\d: '
(none): use test;
Database changed

But remember, the second line of the prompt is unchangeable, which leads to a very ugly:

test: SELECT
    -> 1+2;

This may not seem like a big deal. But for people that copy and paste examples (such as people double-checking their own work, a technical editor, or a reader), they might think to change the prompt, so they can copy and paste examples:

test: prompt /* mysql */ 
PROMPT set to '/* mysql */ '
/* mysql */ SELECT 
    -> "If I could change the second line, then I could copy and paste multi-line examples!";

This should be an easy enough fix for the MySQL client. At the very least the prompt should default to something commented, in my opinion.

Perhaps the Drizzle folks (or XtraDB from Percona) will pick up on this idea and have a default of something commented.

Interested in working with Sheeri? Schedule a tech call.

4 Comments. Leave new

That’s brilliant Sheeri!

I’m pondering whether there could be any downside to just changing the default prompt as well as the continuation prompts, i.e. could it cause anybody trouble… otherwise we can just patch it in OurDelta.


Is there a bug report to request that this functionality gets fixed? If not add one. Then suggest that others who might find it useful to also add comments to the bug saying they want it.

I had a similar issue and although it’s still in the air it is the bugs system:

Sheeri Cabral
March 31, 2009 2:01 pm


I doubt there’s a downside, given that it’s a client thing *only*, and users are allowed to change the prompt.


I’m surprised you didn’t go ahead and make a bug!

Go ahead and put a “me too” there…


I had a patch once that changed the whitespace of the continuation prompt so it lined up with the first prompt. I’ll try to dig it up.


Leave a Reply

Your email address will not be published. Required fields are marked *