Bug #75242 Add connection id option for prompt
Submitted: 17 Dec 2014 8:04 Modified: 11 Feb 2015 17:30
Reporter: Daniël van Eeden (OCA) Email Updates:
Status: Closed Impact on me:
Category:MySQL Server: Command-line Clients Severity:S3 (Non-critical)
Version:5.6.22 OS:Any
Assigned to: CPU Architecture:Any

[17 Dec 2014 8:04] Daniël van Eeden
There are many options which can be used to get a very useful mysql prompt: http://dev.mysql.com/doc/refman/5.6/en/mysql-commands.html

e.g. "\U [\d] > " or "\u@\h [\d] >"

I would like to have the connection ID in there.

This is particulary useful when demonstrating locking:
mysql connection 1> set autocommit=0;
mysql connection 2> set autocommit=0;
mysql connection 1> insert into t1(c1) values('test');
mysql connection 2> insert into t1(c1) values('test'); 

How to repeat:
See description

Suggested fix:
Add "\C" for connection id to the prompt
[17 Dec 2014 9:07] MySQL Verification Team
Hello Daniël,

Thank you for the feature request!

[17 Dec 2014 10:27] Tsubasa Tanaka
Patch based on MySQL 5.6.22's mysql command-line client.

(*) I confirm the code being submitted is offered under the terms of the OCA, and that I am authorized to contribute it.

Contribution: bug75242.patch (application/octet-stream, text), 459 bytes.

[17 Dec 2014 10:27] Tsubasa Tanaka
I agree and wrote a patch.
[17 Dec 2014 10:49] MySQL Verification Team
Thank you tsubasa-san for the contribution.

[11 Feb 2015 17:30] Paul DuBois
Noted in 5.7.6 changelog.

The mysql client program now supports \C in the prompt command to
signify the current connection identifier. Thanks to Tsubasa Tanaka
for the patch.