By smartbet79
no problem when connect via DBeaver but,
unable to connect from droplet whit pdo (php 7.2),
converted downloaded ca-certificate from crt to pem and tried both crt and pem,
PDO::MYSQL_ATTR_SSL_VERIFY_SERVER_CERT tried both, true and false
same result.
$dsn = ‘mysql:’; $dsn .= ‘host=’ . $this->Host . ‘;’; $dsn .= ‘port=’ . $this->DBPort . ‘;’; if (!empty($this->DBName)) { $dsn .= ‘dbname=’ . $this->DBName . ‘;’; } $dsn .= ‘charset=utf8mb4;’; $this->pdo = new PDO($dsn, $this->DBUser, $this->DBPassword, array( PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION, PDO::MYSQL_ATTR_USE_BUFFERED_QUERY => true, PDO::MYSQL_ATTR_SSL_CA => ‘/var/www/html/mycert.pem’, PDO::MYSQL_ATTR_SSL_CIPHER => ‘ECDHE-RSA-AES256-SHA384’, PDO::MYSQL_ATTR_SSL_VERIFY_SERVER_CERT => true ) );
Unhandled Exception. SQLSTATE[HY000] [2054] The server requested authentication method unknown to the client
any help?
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
Hi,
This is probably because managed databases use MySQL 8 and the default authentication plugin is caching_sha2_password.
This article, in particular the section labelled “A Note Regarding Password Authentication in MySQL 8” is probably going to help you!
https://www.digitalocean.com/community/tutorials/how-to-connect-to-managed-database-ubuntu-18-04
Thanks
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.