In database.php
modify to have these lines, yours might not have it already included:
'sslmode' => env('DB_SSLMODE', 'prefer'),
'options' => extension_loaded('pdo_mysql') ? array_filter([
PDO::MYSQL_ATTR_SSL_CA => env('MYSQL_ATTR_SSL_CA') !== null
? base_path(env('MYSQL_ATTR_SSL_CA'))
: env('MYSQL_ATTR_SSL_CA'),
]) : [],
Then, in .env
you must add two additional keys:
MYSQL_ATTR_SSL_CA=ca.crt
Where this file is inside the current project directory, you can make this an absolute path by remove base_path()
wrapping the env('MYSQL_ATTR_SSL_CA')
Leave a Reply