MySQL Database Cluster + Laravel

I've setup a MySQL Database Cluster and an Ubuntu server with Apache and PHP 8.1.

When I SSH onto the Ubuntu server I'm able to connect to the cluster:

mysql --host=lin-*** --user=*** --password --ssl-mode=required

However, when I run php artisan migrate I get the following error:


  SQLSTATE[HY000] [3159] Connections using insecure transport are prohibited while --require_secure_transport=ON. (SQL: select * from information_schema.tables where table_schema = xxx and table_name = migrations and table_type = 'BASE TABLE')

  at vendor/laravel/framework/src/Illuminate/Database/Connection.php:712
    708▕         // If an exception occurs when attempting to run a query, we'll format the error
    709▕         // message to include the bindings with SQL, which will make this exception a
    710▕         // lot more helpful to the developer instead of just the database's errors.
    711▕         catch (Exception $e) {
  ➜ 712▕             throw new QueryException(
    713▕                 $query, $this->prepareBindings($bindings), $e
    714▕             );
    715▕         }
    716▕     }

      +33 vendor frames 
  34  artisan:37

Having not setup any certificates, I'm not clear what I would add to my .env to config\database.php to get this working.

Any advice greatly appreciated.

2 Replies

Unrelated: I edited this post, but the changes don't save. Not a great look.


It's actually super simple, in the Linode UI there is a CA certificate to download, place that with your application.

Then add:

    'sslmode' => env('DB_SSLMODE', 'prefer'),
    'options'   => array(
        PDO::MYSQL_ATTR_SSL_CA      => '/path/to/ca-cert.pem',

This should get you going :)


Please enter an answer

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct