laravel 使用 migrate在DRDS数据库下迁移不成功解决方法

DRDS下进行数据库迁移。

命令行输入命令:

php artisan migrate

返回:

Symfony\Component\Debug\Exception\FatalThrowableError  : Argument 1 passed to Illuminate\Database\Connection::prepared() must be an instance of PDOStatement, boolean given, called in E:\phpStudy\PHPTu
torial\WWW\meinvtu-app-backend\vendor\laravel\framework\src\Illuminate\Database\Connection.php on line 326

  at E:\phpStudy\PHPTutorial\WWW\meinvtu-app-backend\vendor\laravel\framework\src\Illuminate\Database\Connection.php:380
    376|      *
    377|      * @param  \PDOStatement  $statement
    378|      * @return \PDOStatement
    379|      */
  > 380|     protected function prepared(PDOStatement $statement)
    381|     {
    382|         $statement->setFetchMode($this->fetchMode);
    383|
    384|         $this->event(new Events\StatementPrepared(

  Exception trace:

  1   Illuminate\Database\Connection::prepared()
      E:\phpStudy\PHPTutorial\WWW\meinvtu-app-backend\vendor\laravel\framework\src\Illuminate\Database\Connection.php:326

  2   Illuminate\Database\Connection::Illuminate\Database\{closure}("select * from information_schema.tables where table_schema = ? and table_name = ?")
      E:\phpStudy\PHPTutorial\WWW\meinvtu-app-backend\vendor\laravel\framework\src\Illuminate\Database\Connection.php:657

  Please use the argument -v to see more details.

增加模拟预处理就可以解决。

database.php下  ‘mysql' 组下增加 'opions'。

'options' => [
                PDO::ATTR_EMULATE_PREPARES => true,                     // 模拟预处理语句
            ]

完成:

E:\phpStudy\PHPTutorial\WWW\meinvtu-app-backend>php artisan migrate
Migrating: 2019_04_04_174340_admin_add
Migrated:  2019_04_04_174340_admin_add

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值