'Illuminate\Database\QueryException could not find driver [duplicate]

Illuminate\Database\Connection::runQueryCallback C:\wamp\www\LaravelProject\vendor\laravel\framework\src\Illuminate\Database\Connection.php:671

ERROR:

Illuminate\Database\QueryException SQLSTATE[42S02]: Base table or view not found: 1146 Table 'db_laravel.registers' doesn't exist (SQL: insert into registers (name, email, updated_at, created_at) values (dfmgkm, kmfgk, 2020-09-08 04:56:41, 2020-09-08 04:56:41))

" I couldn't insert values to the MySQL because of the connection failure, it's an error in Connection.php file, but my migration is success "

DB_CONNECTION=mysql

DB_HOST=127.0.0.1

DB_PORT=3306

DB_DATABASE=db_laravel

protected function runQueryCallback($query, $bindings, Closure $callback)

{

    try {

        $result = $callback($query, $bindings);

    }

    catch (Exception $e) {

        throw new QueryException(

            $query, $this->prepareBindings($bindings), $e

        );

    }



    return $result;

}


Solution 1:[1]

Try doing this

composer update

composer require doctrine/dbal

Solution 2:[2]

This happened to me after upgrading from php8.0 to php8.1. The solution was to install php extensions for the newer version. In my case:

sudo apt install php8.1-{imagick,bz2,curl,gd,mysql,opcache,xml}

In your case, you probably just need

sudo apt install phpX.X-mysql

where X.X is your php version

Solution 3:[3]

When updating you should check the method. You should make it 'PUT'and make method spoofing @method('PUT') in the form

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Swarnadeep
Solution 2 murume
Solution 3 Mehedi Hasan