博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
php artisan migrate 报错,laravel执行php artisan migrate报错的解决方法
阅读量:6643 次
发布时间:2019-06-25

本文共 3383 字,大约阅读时间需要 11 分钟。

报错一

$ php artisan migrate

Illuminate\Database\QueryException : could not find driver (SQL: select * fr

om information_schema.tables where table_schema = dev_oms and table_name = migra

tions)

at D:\WWW\dev_oms\vendor\laravel\framework\src\Illuminate\Database\Connection.

php:664

660| // If an exception occurs when attempting to run a query, we'll

format the error

661| // message to include the bindings with SQL, which will make th

is exception a

662| // lot more helpful to the developer instead of just the databa

se's errors.

663| catch (Exception $e) {

> 664| throw new QueryException(

665| $query, $this->prepareBindings($bindings), $e

666| );

667| }

668|

Exception trace:

1 PDOException::("could not find driver")

D:\WWW\dev_oms\vendor\laravel\framework\src\Illuminate\Database\Connectors

\Connector.php:68

2 PDO::__construct("mysql:host=127.0.0.1;port=3306;dbname=dev_oms", "root",

"root", [])

D:\WWW\dev_oms\vendor\laravel\framework\src\Illuminate\Database\Connectors

\Connector.php:68

Please use the argument -v to see more details.

原因是php.ini 扩展"php_pdo_mysql.dll"没开启

fa6f41e8208473023f24d7df3a1d1ca1.png

报错二

$ php artisan migrate

Migration table created successfully.

Illuminate\Database\QueryException : SQLSTATE[42000]: Syntax error or access

violation: 1071 Specified key was too long; max key length is 767 bytes (SQL: a

lter table `users` add unique `users_email_unique`(`email`))

at D:\WWW\dev_oms\vendor\laravel\framework\src\Illuminate\Database\Connection.

php:664

660| // If an exception occurs when attempting to run a query, we'll

format the error

661| // message to include the bindings with SQL, which will make th

is exception a

662| // lot more helpful to the developer instead of just the databa

se's errors.

663| catch (Exception $e) {

> 664| throw new QueryException(

665| $query, $this->prepareBindings($bindings), $e

666| );

667| }

668|

Exception trace:

1 PDOException::("SQLSTATE[42000]: Syntax error or access violation: 1071 Sp

ecified key was too long; max key length is 767 bytes")

D:\WWW\dev_oms\vendor\laravel\framework\src\Illuminate\Database\Connection

.php:458

2 PDOStatement::execute()

D:\WWW\dev_oms\vendor\laravel\framework\src\Illuminate\Database\Connection

.php:458

Please use the argument -v to see more details.

数据库编码改为utf8mb4

026a38df46328bef890dcaa469656a00.png

报错三

$ php artisan migrate

Migration table created successfully.

Illuminate\Database\QueryException : SQLSTATE[42000]: Syntax error or access

violation: 1071 Specified key was too long; max key length is 767 bytes (SQL: a

lter table `users` add unique `users_email_unique`(`email`))

at D:\WWW\dev_oms\vendor\laravel\framework\src\Illuminate\Database\Connection.

php:664

660| // If an exception occurs when attempting to run a query, we'll

format the error

661| // message to include the bindings with SQL, which will make th

is exception a

662| // lot more helpful to the developer instead of just the databa

se's errors.

663| catch (Exception $e) {

> 664| throw new QueryException(

665| $query, $this->prepareBindings($bindings), $e

666| );

667| }

668|

Exception trace:

1 PDOException::("SQLSTATE[42000]: Syntax error or access violation: 1071 Sp

ecified key was too long; max key length is 767 bytes")

D:\WWW\dev_oms\vendor\laravel\framework\src\Illuminate\Database\Connection

.php:458

2 PDOStatement::execute()

D:\WWW\dev_oms\vendor\laravel\framework\src\Illuminate\Database\Connection

.php:458

Please use the argument -v to see more details.

转载地址:http://xbevo.baihongyu.com/

你可能感兴趣的文章
分支 判断素数
查看>>
DetachedCriteria的简单使用
查看>>
JavaScript中的函数是数据
查看>>
增加有规律的用户账号脚本
查看>>
VMware嵌套虚拟化
查看>>
ciscoGRE-适合晋级者
查看>>
我的友情链接
查看>>
C语言利用数组和文件登录注册功能
查看>>
新建域时提示“administrator账户密码不符合要求”错误解决方法
查看>>
没有学历的程序员
查看>>
Xbox One 游戏:Forza 5 (分屏)多人本地对战
查看>>
修复电脑图片文件图标不显示的方法
查看>>
win 7 下分区的软件
查看>>
Oracle函数-单行函数-转换函数、条件表达式
查看>>
34补3-3 rhcs集群基础应用
查看>>
我的友情链接
查看>>
迅雷登录IFRAME需求小记
查看>>
用NuGet安装NewtonSoft.json
查看>>
域和域控制器
查看>>
Apache2.4 + MySQL5.5 + PHP5.5 FCGI方式运行
查看>>