laravel執(zhí)行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 擴(kuò)展"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.
數(shù)據(jù)庫編碼改為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.
加上兩行代碼即可
以上這篇laravel執(zhí)行php artisan migrate報錯的解決方法就是小編分享給大家的全部內(nèi)容了,希望能給大家一個參考,也希望大家多多支持腳本之家。
相關(guān)文章
thinkPHP5.0框架獨(dú)立配置與動態(tài)配置方法
這篇文章主要介紹了thinkPHP5.0框架獨(dú)立配置與動態(tài)配置方法,結(jié)合實(shí)例形式分析了thinkPHP5.0框架獨(dú)立配置與靜態(tài)配置的功能、實(shí)現(xiàn)技巧與相關(guān)注意事項,需要的朋友可以參考下2017-03-03laravel修改用戶模塊的密碼驗證實(shí)現(xiàn)
本文主要介紹了laravel修改用戶模塊的密碼驗證實(shí)現(xiàn),文中通過示例代碼介紹的非常詳細(xì),具有一定的參考價值,感興趣的小伙伴們可以參考一下2021-09-09php遠(yuǎn)程請求CURL實(shí)例教程(爬蟲、保存登錄狀態(tài))
這篇文章主要給大家介紹了關(guān)于php遠(yuǎn)程請求CURL(爬蟲、保存登錄狀態(tài))的相關(guān)資料,文中通過示例代碼介紹的非常詳細(xì),對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧2020-12-12PHP錯誤處理函數(shù)register_shutdown_function使用示例
這篇文章主要介紹了PHP錯誤處理函數(shù)register_shutdown_function使用示例,需要的朋友可以參考下2017-07-07Yii2實(shí)現(xiàn)讓關(guān)聯(lián)字段支持搜索功能的方法
這篇文章主要介紹了Yii2實(shí)現(xiàn)讓關(guān)聯(lián)字段支持搜索功能的方法,結(jié)合實(shí)例形式分析了Yii2關(guān)聯(lián)字段搜索功能的原理與相關(guān)實(shí)現(xiàn)技巧,需要的朋友可以參考下2016-08-08