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

前端 未结 2 941
暗喜
暗喜 2021-02-19 07:14

I have been running into this issue every time I try and sync a medium size JSON object to my database so we can perform some reporting on it. From looking into what can cause i

相关标签:
2条回答
  • 2021-02-19 07:56

    While mysqldump is the commonly reported cause for this it is not the only one.

    In my case running artisan:migrate on any database will also trigger this error for different databases on the same server.

    http://bugs.mysql.com/bug.php?id=42041 Mentions table locks/flush which would be called in a mysqldump so worth checking if you have any migrations, locks or flushes happening simultaneously.

    Failing that try switching the prepares to emulated.

    'options'   => [
                \PDO::ATTR_EMULATE_PREPARES => true
            ]
    
    0 讨论(0)
  • 2021-02-19 08:09

    This error occurs when mysqldump is in progress. It doesn't matter which DB dump is in progress. Wait for the dump to finish and this error will vanish.

    The issue is with the table definition being dumped which cause this error.

    Yeah I tried changing these mysql settings, but it still occurs sometime (mostly when running heavy mysql backups/dumps at night)..

    table_open_cache 128=>16384

    table_definition_cache 1024=>16384

    0 讨论(0)
提交回复
热议问题