laravel执行php artisan migrate报错的解决方法
发布:smiling 来源: PHP粉丝网 添加日期:2021-12-28 11:05:51 浏览: 评论:0
今天小编就为大家分享一篇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 = migrations)
- 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.
加上两行代码即可.
Tags: php artisan migrate
相关文章
- ·phpbb3 论坛新贴和本周五大字体修改(2013-11-16)
- ·Wordpress和phpbb数据库结构分析 (2013-11-16)
- ·phpBB3 论坛权限(2013-11-16)
- ·phpBB远程跨站脚本执行漏洞(2013-11-16)
- ·PHPExcel导出Excel文件时出现错误的解决办法(2013-12-02)
- ·关于CMD不能运行php.exe的问题~~(2014-11-20)
- ·简单方法修改drupal运行时的php内存(2015-04-04)
- ·phpweb更换百度编辑器的配置教程(2015-04-04)
- ·分享几个zblogPHP调用文章分类列表的方法(2015-12-07)
- ·PHP7下安装Emlog5.3.1的笔记(2016-08-22)
- ·cakephp2.X多表联合查询join及使用分页查询的方法(2018-08-02)
- ·详解PHP的Yii框架中扩展的安装与使用(2019-10-20)
- ·PHP的Yii框架中创建视图和渲染视图的方法详解(2019-11-05)
- ·php采集cms有哪些(2020-04-28)
- ·Codeigniter生成Excel文档的简单方法(2021-02-13)
- ·Codeigniter+PHPExcel实现导出数据到Excel文件(2021-02-13)
推荐文章
热门文章
最新评论文章
- 写给考虑创业的年轻程序员(10)
- PHP新手上路(一)(7)
- 惹恼程序员的十件事(5)
- PHP邮件发送例子,已测试成功(5)
- 致初学者:PHP比ASP优秀的七个理由(4)
- PHP会被淘汰吗?(4)
- PHP新手上路(四)(4)
- 如何去学习PHP?(2)
- 简单入门级php分页代码(2)
- php中邮箱email 电话等格式的验证(2)