返回顶部
首页 > 资讯 > 后端开发 > PHP编程 >laravel9.38.0中执行php artisan migrate提示could not find driver
  • 578
分享到

laravel9.38.0中执行php artisan migrate提示could not find driver

phpmysql数据库laravelmigrate 2023-09-05 17:09:29 578人浏览 独家记忆
摘要

如题,运行PHP artisan migrate导入数据库到Mysql时,报了错误: C:\Users\Administrator\Downloads\laravel9.38.0>php artisan migrate Illumina

如题,运行PHP artisan migrate导入数据库Mysql时,报了错误:

C:\Users\Administrator\Downloads\laravel9.38.0>php artisan migrate   Illuminate\Database\QueryException  could not find driver (SQL: select * from information_schema.tables where table_schema = laravel and table_name = migrations and table_type = 'BASE TABLE')  at C:\Users\Administrator\Downloads\laravel9.38.0\vendor\laravel\framework\src\Illuminate\Database\Connection.php:760    756▕         // If an exception occurs when attempting to run a query, we'll format the error    757▕         // message to include the bindings with SQL, which will make this exception a    758▕         // lot more helpful to the developer instead of just the database's errors.    759▕         catch (Exception $e) {  ➜ 760▕             throw new QueryException(    761▕                 $query, $this->prepareBindings($bindings), $e    762▕             );    763▕         }    764▕     }  1   C:\Users\Administrator\Downloads\laravel9.38.0\vendor\laravel\framework\src\Illuminate\Database\Connectors\Connector.php:70      PDOException::("could not find driver")  2   C:\Users\Administrator\Downloads\laravel9.38.0\vendor\laravel\framework\src\Illuminate\Database\Connectors\Connector.php:70      PDO::__construct("mysql:host=127.0.0.1;port=3306;dbname=laravel", "root", "", [])

这种问题实际上是php中没有配置mysql插件导致的。php连接mysql的驱动程序有两种:MySQLi 和 PDO,你只需要在配置文件php.ini中将它启用,由于上面的报错是没有启用PDO扩展导致的,这里将“;extension=pdo_mysql”一行前面的分号去掉即可。

 

来源地址:https://blog.csdn.net/qiuchangyong/article/details/128027473

--结束END--

本文标题: laravel9.38.0中执行php artisan migrate提示could not find driver

本文链接: https://lsjlt.com/news/395841.html(转载时请注明来源链接)

有问题或投稿请发送至: 邮箱/279061341@qq.com    QQ/279061341

猜你喜欢
软考高级职称资格查询
编程网,编程工程师的家园,是目前国内优秀的开源技术社区之一,形成了由开源软件库、代码分享、资讯、协作翻译、讨论区和博客等几大频道内容,为IT开发者提供了一个发现、使用、并交流开源技术的平台。
  • 官方手机版

  • 微信公众号

  • 商务合作