|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #81314 Add possibility to add MySQL Connection Attributes (incl. custom ones)
Submitted: 2021-07-30 16:00 UTC Modified: -
Avg. Score:4.2 ± 0.7
Reproduced:5 of 5 (100.0%)
Same Version:4 (80.0%)
Same OS:4 (80.0%)
From: andygrunwald at gmail dot com Assigned:
Status: Open Package: MySQLi related
PHP Version: 8.0.9 OS: -
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: andygrunwald at gmail dot com
New email:
PHP Version: OS:


 [2021-07-30 16:00 UTC] andygrunwald at gmail dot com
MySQL offers to set Connection Attributes: See

Next to the reserved connection attributes (_client_name, ...), many applications set custom attributes, like `program_name`:

- mysqld:
- ProxySQL:
- mysqlcheck:
- mysqladmin:
- and many more

Many programming languages, enable this feature via the DSN like Python  ( or via setter functions like Java (

PHP (mysqli or PDO) doesn't offer any kind of possibility to set a custom connection attribute like `program_name` .

With mysqli_options you can set options, but non of them are connection attributes, see
The mysqli constructor doesn't support DSNs, see

The PDO constructor does provide DSNs, see
But I can't see any possibilities for custom connection attributes from the user space.

mysqlnd does set already the _client_name attribute. See

The goal of this feature request should be:
Create a way to set custom connection attributes during the connection to a MySQL server.


Add a Patch

Pull Requests

Add a Pull Request

PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Thu Jun 08 01:03:41 2023 UTC