The official documentation page for PDO DSN does not list out username or password yet. What is the correct name for these key-value pairs?
Looks like the documentation hasn't been updated yet, but this is the related change from PHP's source repository, stating how it should be used:
PDO: The username and password can now be specified as part of the PDO DSN for the mysql, mssql, sybase, dblib, firebird and oci drivers. Previously this was only supported by the pgsql driver. If a username/password is specified both in the constructor and the DSN, the constructor takes precedence.
new PDO("mysql:host=xxx;port=xxx;dbname=xxx;user=xxx;password=xxx");
And here's the associated pull request.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With