SQLSTATE[HY000]  using database cluster with Laravel
- Laravel 8.83.20
- PHP 7.4.30
- MySQL 8.0.26
- IP added under access control
'options' => extension_loaded('pdo_mysql') ? array_filter([ PDO::MYSQL_ATTR_SSL_CA => env('MYSQL_ATTR_SSL_CA'), PDO::MYSQL_ATTR_SSL_VERIFY_SERVER_CERT => false ]) : ,
And then for environment variables:
DB_CONNECTION=mysql DB_HOST=(hidden) DB_PORT=3306 DB_DATABASE=(hidden) DB_USERNAME=linroot DB_PASSWORD=(hidden) MYSQL_ATTR_SSL_CA=/var/lib/mysql/cert.pem
config:clear but still getting
SQLSTATE[HY000] . I should mention that I am able to connect from said server via the mysql command, whether I use the
ssl-ca option or not.
Any ideas? Much appreciated!
@ryanduval There could be a few reasons why you're having trouble accessing your cluster via Laravel. There are two Community Questions post that may help you with your troubleshooting. I've linked them down below.
- MySQL error message SQLSTATE[HY000]  Connection refused
- MySQL isn't accessible with error 'Can't connect to local MySQL server through socket'. What's wrong with MySQL?
You may also come across some Laravel specific support on their community forum.
Hope this helps you out some!
The first post suggests the port is wrong, but I'm using the default 3306, which is also what the cluster uses. I would love to look at the logs to see what is happening, but Linode controls that.
The second post doesn't seem related as we're not using a socket connection.