|  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:7 of 7 (100.0%)
Same Version:5 (71.4%)
Same OS:5 (71.4%)
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
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please — but make sure to vote on the bug!
Your email address:
Solve the problem:
32 + 44 = ?
Subscribe to this entry?

 [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-2024 The PHP Group
All rights reserved.
Last updated: Thu Jul 18 21:01:27 2024 UTC