Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/mysql/59.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何使用laravel连接mysql数据库_Mysql_Laravel - Fatal编程技术网

如何使用laravel连接mysql数据库

如何使用laravel连接mysql数据库,mysql,laravel,Mysql,Laravel,我正在尝试连接Laravel中的MySQL数据库,有一些问题 这是Laravel中.env文件中的MySQL凭据 DB_CONNECTION=mysql DB_HOST=127.0.0.1 DB_PORT=3306 DB_DATABASE=welcome DB_USERNAME=krishna DB_PASSWORD=Krish_123 我正在尝试迁移,它显示了一些错误,如bellow siva@siva-Latitude-3490:~/Desktop/laravel-practies-pro

我正在尝试连接Laravel中的MySQL数据库,有一些问题

这是Laravel中.env文件中的MySQL凭据

DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=welcome
DB_USERNAME=krishna
DB_PASSWORD=Krish_123
我正在尝试迁移,它显示了一些错误,如bellow

siva@siva-Latitude-3490:~/Desktop/laravel-practies-project$ php artisan migrate

   Illuminate\Database\QueryException 

  could not find driver (SQL: select * from information_schema.tables where table_schema = welcome and table_name = migrations and table_type = 'BASE TABLE')

  at vendor/laravel/framework/src/Illuminate/Database/Connection.php:671
    667|         // If an exception occurs when attempting to run a query, we'll format the error
    668|         // message to include the bindings with SQL, which will make this exception a
    669|         // lot more helpful to the developer instead of just the database's errors.
    670|         catch (Exception $e) {
  > 671|             throw new QueryException(
    672|                 $query, $this->prepareBindings($bindings), $e
    673|             );
    674|         }
    675| 

      +34 vendor frames 
  35  artisan:37
      Illuminate\Foundation\Console\Kernel::handle(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))

信息不足,这是本地开发还是部署生产问题?您在什么操作系统上使用什么堆栈?这是本地开发。我用乌本图德回答你的问题?可能重复: