|  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.3 ± 0.7
Reproduced:6 of 6 (100.0%)
Same Version:5 (83.3%)
Same OS:4 (66.7%)
From: andygrunwald at gmail dot com Assigned:
Status: Open Package: MySQLi related
PHP Version: 8.0.9 OS: -
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
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: Wed Oct 04 08:01:25 2023 UTC