note 129919 added to book.pdo

From: Date: Tue, 17 Dec 2024 14:38:22 +0000
Subject: note 129919 added to book.pdo
Groups: php.notes 
Request: Send a blank email to php-notes+get-221726@lists.php.net to get a copy of this message
Now that current versions of MySQL are forcing users to authenticate with caching_sha2_password instead of mysql_native_driver, I wanted to get PDO to send passwords that way. I think the only way to do it is to make the connection over SSL. Setting up your web server and database server for SSL is way beyond the scope of this note, but after you do, remember that you will need to add an options array as the last argument in your PDO connection arguments. At a minimum, you will need to supply the server certificate. In a development environment with a self-signed server certificate, you will also want to bypass verification that your server certificate is 'real'. So your options array would look like this $opts = [ PDO::MYSQL_ATTR_SSL_CA => $server_cert_file_path, PDO::MYSQL_ATTR_SSL_VERIFY_SERVER_CERT => false]; Hope it helps! ---- Server IP: 45.112.84.4 Probable Submitter: 45.112.84.18 (proxied: 71.176.35.66) ---- Manual Page -- https://php.net/manual/en/book.pdo.php Edit -- https://main.php.net/note/edit/129919 Del: integrated -- https://main.php.net/note/delete/129919/integrated Del: useless -- https://main.php.net/note/delete/129919/useless Del: bad code -- https://main.php.net/note/delete/129919/bad+code Del: spam -- https://main.php.net/note/delete/129919/spam Del: non-english -- https://main.php.net/note/delete/129919/non-english Del: in docs -- https://main.php.net/note/delete/129919/in+docs Del: other reasons-- https://main.php.net/note/delete/129919 Reject -- https://main.php.net/note/reject/129919 Search -- https://main.php.net/manage/user-notes.php

« previous php.notes (#221726) next »