Laravel: General error: 1615 Prepared statement needs to be re-prepared

It seems to work adding

'options'   => [
                \PDO::ATTR_EMULATE_PREPARES => true
            ]

Inside projectName/config/database.php file in DB configuration. It will be like this:

'mysql' => [
    'driver'    => 'mysql',
    'host'      => env('DB_HOST', 'localhost'),
    'database'  => env('DB_DATABASE', 'forge'),
    'username'  => env('DB_USERNAME', 'forge'),
    'password'  => env('DB_PASSWORD', ''),
    'charset'   => 'utf8',
    'collation' => 'utf8_unicode_ci',
    'prefix'    => '',
    'strict'    => false,
    'options'   => [
        \PDO::ATTR_EMULATE_PREPARES => true
    ]
],

Laravel 5.1. Hope it will help!

Edit: I'm currently on Laravel 8 and this solution is still working.


As per the comments in the accepted answer, running

SET GLOBAL table_definition_cache = 1024

in the MariaDB solved the problem.

https://mariadb.com/kb/en/library/server-system-variables/#table_definition_cache