Laravel SQLSTATE [HY000]:一般错误:1615准备好的语句需要重新准备

时间:2022-01-23 07:50:16

I recently launched my Laravel based site, and I had no problems, but 40 mins ago when I checked it I get this error:

我最近推出了基于Laravel的网站,我没有遇到任何问题,但是40分钟前我检查时发现了这个错误:

SQLSTATE[HY000]: General error: 1615 Prepared statement needs to be re-prepared (SQL: select * from `users` where `id` = 1 and `remember_token` = mfjLlbv3fR49TYGAqmUgBSqVVAKmoHhq26ws8rojuXxee5qWcvHrcdoTXs6W limit 1) 

Why is this happening? Everything was okay and now suddenly I cannot do anything.

为什么会这样?一切都很好,现在突然间我无能为力。

3 个解决方案

#1


5  

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.

当mysqldump正在进行时会发生此错误。哪个数据库转储正在进行并不重要。等待转储完成,此错误将消失。

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

问题是转储的表定义会导致此错误。

Cheers,

Suren

#2


1  

Hello i got the same error, after few refreshes is gone. Maybe the mysqldump is the source of the problem.

你好我有同样的错误,几次刷新后不见了。也许mysqldump是问题的根源。

When i logged the mysqldump was not running, but maybe it was finished, because when i refreshed there was no error

当我记录mysqldump没有运行,但也许它已经完成,因为当我刷新时没有错误

#3


0  

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:

在DB配置中的projectName / config / database.php文件内。它会是这样的:

'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!

Laravel 5.1。希望它会有所帮助!

#1


5  

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.

当mysqldump正在进行时会发生此错误。哪个数据库转储正在进行并不重要。等待转储完成,此错误将消失。

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

问题是转储的表定义会导致此错误。

Cheers,

Suren

#2


1  

Hello i got the same error, after few refreshes is gone. Maybe the mysqldump is the source of the problem.

你好我有同样的错误,几次刷新后不见了。也许mysqldump是问题的根源。

When i logged the mysqldump was not running, but maybe it was finished, because when i refreshed there was no error

当我记录mysqldump没有运行,但也许它已经完成,因为当我刷新时没有错误

#3


0  

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:

在DB配置中的projectName / config / database.php文件内。它会是这样的:

'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!

Laravel 5.1。希望它会有所帮助!