0

I have tried db connection by add pem cert files and pdo_mysql setup. But always getting below error.

SQLSTATE[HY000] [2002] Connection refused

Laravel config/database.php configured like below.


'mysql' => [
    'driver' => 'mysql',
    'host' => env('DB_HOST', '127.0.0.1'),
    'port' => env('DB_PORT', '3306'),
    'database' => env('DB_DATABASE', 'forge'),
    'username' => env('DB_USERNAME', 'forge'),
    'password' => env('DB_PASSWORD', ''),
    'unix_socket' => env('DB_SOCKET', ''),
    'charset' => 'utf8mb4',
    'collation' => 'utf8mb4_unicode_ci',
    'prefix' => '',
    'sslmode' => env('DB_SSLMODE', 'prefer'),
    'options'   => array(
        PDO::MYSQL_ATTR_SSL_CA      => 'certs/ca-cert.pem',
        PDO::MYSQL_ATTR_SSL_VERIFY_SERVER_CERT => false
    ),
    'strict' => true,
    'engine' => null,
],
5
  • Maybe this other post could help you stackoverflow.com/q/53061182/7117697 Commented Sep 11, 2020 at 17:10
  • @KennyHorna Thanks for your answer. But my server won't have any issue clearing cache. I connected another DB without SSL its works fine only getting issue in SSL with pem file option. Commented Sep 11, 2020 at 17:12
  • Is your server configured accordingly? Commented Sep 12, 2020 at 4:53
  • @JonathanMartins Yes server configured correctly. Commented Sep 14, 2020 at 12:03
  • Same DB. I can able to connect via Heidi SQL in SSL option. Only laravel it throws this error. Commented Sep 14, 2020 at 13:09

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.