php manjaro 中的 artisan 迁移错误 linux

php artisan migrate error in manjaro linux

我在 manjaro linux 中使用 laravel.. 如果我执行 php artisan migrate 命令,它会给我这个错误,我该如何解决这个问题。我也已经安装 xampp 谢谢..

错误:

Illuminate\Database\QueryException  : could not find driver (SQL: select * from     information_schema.tables where table_schema = nws and table_name = migrations and t    able_type = 'BASE TABLE')

at /run/media/snake/Entertainment/VS/linuxTest/Nurses/NW/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 this exception a
    662|         // lot more helpful to the developer instead of just the database'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")
    run/media/snake/Entertainment/VS/linuxTest/Nurses/NW/vendor/laravel/framework/src/
    lluminate/Database/Connectors/Connector.php:70

      2 PDO::__construct("mysql:host=127.0.0.1;port=3306;dbname=nws", "root", "", [])
    /run/media/snake/Entertainment/VS/linuxTest/Nurses/NW/vendor/laravel/framework/src/
    Illuminate/Database/Connectors/Connector.php:70

    Please use the argument -v to see more details.

确保您已经安装了 Maria / MySQL 并且它是 PHP 驱动程序。

sudo pacman -Syu mariadb mariadb-clients libmariadbclient

我的解决方案是在 .env 中使用 localhost 而不是 127.0.0.1...

DB_HOST=127.0.0.1

DB_HOST=localhost

试试这个,对我有用...