Set Program Name for display in MySQL Process List

3.2k Views Asked by At

Is there a way to specify the Program name for an entry in the process list? Usually, all the connections say 'None' or 'MySQLWorkbench'. There was one case where I actually saw the name of the .exe I was running in the list of connections but I don't know why.

Here's a picture of what I'm talking about from the MySQLWorkbench Client Connections management page.

List of Program Name in MySQl Client Connections

I'm using Connector/Net 6.9.6, and I didn't see anything in the connection string options.

2

There are 2 best solutions below

1
Ronan Luis Sayão On

I've found the solution for that, you just need to add the following string in the URL: &connectionAttributes=program_name:[APP_NAME]

  • [APP_NAME] change by your application name or anything that you want.
0
Bradley Grainger On

The "Program Name" column in MySQL Workbench comes from a program_name connection attribute. The MySQL documentation incorrectly claims that:

MySQL Connector/NET defines these attributes:

  • _program_name: The client name

This is wrong in two ways: the attribute name has a typo (leading underscore) and the code that sets it was deleted.

There is no way (a connection string setting or otherwise) to set the value of this attribute in MySQL Connector/NET. Furthermore, the connection attributes are part of the initial handshake so there is no way to set them after the connection is established (e.g., in your application code).

If you're willing to change ADO.NET connector libraries, the MySqlConnector library added support for an Application Name connection string option in v0.44.0; this will let you control the connection attribute that's sent to the server (and it will show up in MySQL Workbench).