在facade.php 221中,调用未定义的方法MySqlBuilder :: defaultStringLenght()

时间:2018-01-04 13:18:46

标签: laravel artisan artisan-migrate

在windows命令promt full eror中它给出了一些php artisan命令

C:\xampp\htdocs\jj>php artisan migrate

In Connection.php line 664:

  SQLSTATE[HY000] [1049] Unknown database 'juwelleryjournal' (SQL: select * from information_schema
  .tables where table_schema = juwelleryjournal and table_name = migrations)


In Connector.php line 67:

  SQLSTATE[HY000] [1049] Unknown database 'juwelleryjournal'

, & php artisan make:"blabla" works well

如果您遇到同样的错误,最新的Windows php版本可能是您的选择,但它只帮助了我的同学,而不是我。我发现已经在堆栈溢出(Call to undefined method Illuminate\Database\Schema\MySqlBuilder::defaultStringLength())并且也没有帮助。这在笔记本电脑(win7)和台式电脑(win10)上也是如此。我两个都有laravel5.5.28。

有人有任何建议吗?

2 个答案:

答案 0 :(得分:0)

将此添加到您的AppServiceProvider

use Illuminate\Support\Facades\Schema;
function boot()
  {
   Schema::defaultStringLength(191);
  }

答案 1 :(得分:0)

 Call to undefined method Illuminate\Database\Schema\MySqlBuilder::defaultStringLenght()

=>方法名称错误,应该是defaultStringLength