laravel执行php artisan migrate报错的解决方法
作者:_吴慧良 发布时间:2024-06-05 09:44:39
标签:laravel,php,artisan,migrate
报错一
$ 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"没开启
报错二
$ 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
报错三
$ 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.
加上两行代码即可
来源:https://blog.csdn.net/Code_Pupil/article/details/80371145


猜你喜欢
- 一、问答平台这个「生活常识解答」机器人采用的是:阿里达摩院发布的语言模型PLUG(最近刚发布的,目前是测试阶段),地址链接如下:https:
- 开发环境:Ubuntu16.04+Django 1.11.9+Python2.7一:使用自定义函数输出日志到log文件:import tim
- PHP获取当前url路径的函数及服务器变量:代码:<?php$path = /usr/opt/../ect/abcd;echo $_S
- mysql 时间转换函数的用法DAYOFWEEK(date) 返回日期date的星期索引(1=星期天,2=
- python提取特定时间段内的数据尝试一下:data['Date'] = pd.to_datetime(data['
- 插值主要用于物理学数学中,逼近某一确定值的方法(1)插值是通过已知的离散数据求未知数据的方法。(2)与拟合不同,插值要求曲线通过所有的已知数
- 隐藏并修改文件的最后修改时间的asp-webshell。源码:<% '隐藏并修改文件的最后修改时间的aspshell '
- 模板引擎的思想是来源于MVC(Model View Controller)模型,即模型层、视图层、控制器层。在Web端,模型层为数据库的操作
- 加强ASP网站后台安全一些主要措施:----------------------------------------------------
- time()在PHP中是得到一个数字,这个数字表示从1970-01-01到现在共走了多少秒,很奇怪吧 不过这样方便计算, 要找出前一天的时间
- python的时间模块生成时间戳的方法是非常简单的,因为最近频繁用到了时间戳功能,这里简单总结了一下日常使用最为频繁的两个时间模块各自生成当
- 今天交流会上,分享前端的开发经验,有一条虽然很快带过,但是我倒是印象蛮深刻的,就写点小结来分享一下吧。不知道是标准害了大家还是大家害了标准,
- 在并不知道DIV浮动层的宽度,高度的情况下,如何使浮动层在任何分辩率的情况下居中呢! 下面使用了JAVASCRIPT来
- 本文实例为大家分享了JavaScript实现动态生成表格的具体代码,供大家参考,具体内容如下功能描述在输入框中输入行和列,点击按钮,生成拥有
- 例子老规矩,先上一个代码:def add(s, x): return s + xdef gen(): for i in range(4):
- 而str.replace(/\-/g,"!")则可以全部替换掉匹配的字符(g为全局标志)。replace()The re
- 本文实例为大家分享了python实现flappy bird的简单代码,供大家参考,具体内容如下import pygamefrom pygam
- 前言本文的脚本是分析nginx的访问日志, 主要为了检查站点uri的访问次数的,检查的结果会提供给研发人员做参考,因为谈到分析嘛,那肯定要用
- http://serverName/appName/module/action/id/1/这个就是pathinfo模式在不考虑路由的情况下,
- 本文实例讲述了python中urllib模块用法。分享给大家供大家参考。具体分析如下:一、问题:近期公司项目的需求是根据客户提供的api,我