简体   繁体   English

找不到驱动程序(SQL:选择 user_id

[英]could not find driver (SQL: select user_id

I am getting this error我收到此错误

could not find driver (SQL: select user_id... ]找不到驱动程序(SQL:选择 user_id... ]

I've looked at other related questions and tried the suggestions but I am still getting the same error.我查看了其他相关问题并尝试了建议,但我仍然遇到相同的错误。

My PHP.ini has extension=php_pdo_mysql.dll我的 PHP.ini 有 extension=php_pdo_mysql.dll

I've added "doctrine/dbal": "^2.5",我添加了"doctrine/dbal": "^2.5",

I've also tried clearing cache, config, dump auto load etc.我也试过清除缓存、配置、转储自动加载等。

phpinfo() shows there are no PDO drivers. phpinfo() 显示没有 PDO 驱动程序。

Previously my phpstorm was pointing at a PHP installation that didn't have extension=php_pdo_mysql.dll enabled but I am still getting the same error even after pointing it to the correct PHP folder.以前,我的 phpstorm 指向没有启用extension=php_pdo_mysql.dll的 PHP 安装,但即使将其指向正确的 PHP 文件夹,我仍然遇到相同的错误。

You need to install PDO drivers first and if it did not solve your problem then below is the issue I have faced before maybe that will help.您需要先安装 PDO 驱动程序,如果它没有解决您的问题,那么下面是我之前遇到的问题,也许会有所帮助。

sudo apt-get install php5.6-mysql/php7.2-mysql

You also can search for other database systems.您还可以搜索其他数据库系统。

You also can search for the driver:您也可以搜索驱动程序:

sudo apt-cache search drivername

Then Run the cmd php artisan migrate然后运行cmd php artisan migrate

You can also try:你也可以试试:

sudo apt-get install php-sqlite3

also check the path for php-cli还要检查 php-cli 的路径

If you can, run :如果可以,请运行:

composer update

composer require doctrine/dbal

It looks like you have a missing dependency看起来您缺少依赖项

Edit:编辑:

You might need to comment out the following in your php.ini file.您可能需要在 php.ini 文件中注释掉以下内容。

;extension=pdo_mysql.so

Taken from this post: Laravel 5 PDOException Could Not Find Driver .摘自这篇文章:Laravel 5 PDOException 无法找到驱动程序 I think I had to do something exactly like this when setting up laravel on digital ocean.我想在数字海洋上设置 Laravel 时,我必须做类似的事情。

There must be Query like this one in the code implode inside SQL code. SQL代码内部的代码内爆一定有这样的Query。 check the variable $mistakeIdArr should not be empty.检查变量 $mistakeIdArr 不应为空。

 $sql = "Select * from `mistake` where `id` in (".implode(',',$mistakeIdArr).")";

I have also checked in my code the PDO is enabled or not我还检查了我的代码是否启用了 PDO

if (extension_loaded('pdo')) { echo "pdo enable";die; }else{ echo "not enable";die;}

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 我尝试在 laravel 上使用 postgresql 但找不到驱动程序(SQL:select * 来自“用户”,其中“id”= 4 限制 1) - I tried using postgresql on laravel but got could not find driver (SQL: select * from “users” where “id” = 4 limit 1) Laravel 8 - 找不到驱动程序:Illuminate\Database\QueryException 找不到驱动程序(SQL:select * 来自“列表”) - Laravel 8 - Could not find driver : Illuminate\Database\QueryException could not find driver (SQL: select * from `list`) 通过user_id用PHP更新4个SQL字段 - Updating 4 SQL fields with PHP by user_id Laravel 在 DB 中查找 where('week', $week) 和 where('user_id', $user_id) 来查找 id - Laravel find in DB where('week', $week) and where('user_id', $user_id) to find id 如何将 session 密钥 user_id 传递给“Select from” sql 语句 - How to pass session key user_id to “Select from” sql statement SQL LIKE问题,如果我想从user_id的中选择1,则选择1、10和11 - SQL LIKE issue it selects 1, 10 and 11 if i want to select 1 from my user_id's 用户:: find($ user_id)的Laravel分页问题 - Laravel pagination problem with User::find($user_id) 将user_id从sql中的一个表转换为另一个表 - Translating user_id from one table in sql to another table SQL查询来提取具有相同user_id的多个条目 - SQL query to pull multiple entries with same user_id 在SQL字段WHERE LIKE%$ user_id%中搜索 - Searching in SQL field WHERE LIKE %$user_id%
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM