laravel執(zhí)行php artisan migrate報(bào)錯(cuò)的解決方法
報(bào)錯(cuò)一
$ 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"沒(méi)開(kāi)啟
報(bào)錯(cuò)二
$ 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ù)庫(kù)編碼改為utf8mb4
報(bào)錯(cuò)三
$ 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報(bào)錯(cuò)的解決方法就是小編分享給大家的全部?jī)?nèi)容了,希望能給大家一個(gè)參考,也希望大家多多支持腳本之家。
相關(guān)文章
thinkphp中ajax與php響應(yīng)過(guò)程詳解
這篇文章主要介紹了thinkphp中ajax與php響應(yīng)過(guò)程,以實(shí)例形式詳細(xì)分析了ThinkPHP框架中Ajax響應(yīng)方式的處理原理及實(shí)現(xiàn)過(guò)程,非常具有實(shí)用價(jià)值,需要的朋友可以參考下2014-12-12thinkPHP5.0框架獨(dú)立配置與動(dòng)態(tài)配置方法
這篇文章主要介紹了thinkPHP5.0框架獨(dú)立配置與動(dòng)態(tài)配置方法,結(jié)合實(shí)例形式分析了thinkPHP5.0框架獨(dú)立配置與靜態(tài)配置的功能、實(shí)現(xiàn)技巧與相關(guān)注意事項(xiàng),需要的朋友可以參考下2017-03-03laravel修改用戶模塊的密碼驗(yàn)證實(shí)現(xiàn)
本文主要介紹了laravel修改用戶模塊的密碼驗(yàn)證實(shí)現(xiàn),文中通過(guò)示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下2021-09-09php遠(yuǎn)程請(qǐng)求CURL實(shí)例教程(爬蟲(chóng)、保存登錄狀態(tài))
這篇文章主要給大家介紹了關(guān)于php遠(yuǎn)程請(qǐng)求CURL(爬蟲(chóng)、保存登錄狀態(tài))的相關(guān)資料,文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)學(xué)習(xí)吧2020-12-12PHP錯(cuò)誤處理函數(shù)register_shutdown_function使用示例
這篇文章主要介紹了PHP錯(cuò)誤處理函數(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