Salut à tous, je débute avec le framework laravel et je rencontre une erreur lors de l’exécution des migrations.
voici ma configuration :
.envdatabase.php
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6DB_CONNECTION=mysql DB_HOST=127.0.0.1 DB_PORT=3306 DB_DATABASE=events DB_USERNAME=root DB_PASSWORD=mysql
voici la migration
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14 'mysql' => [ 'driver' => 'mysql', 'host' => env('DB_HOST', '127.0.0.1'), 'port' => env('DB_PORT', '3306'), 'database' => env('DB_DATABASE', 'forge'), 'username' => env('DB_USERNAME', 'forge'), 'password' => env('DB_PASSWORD', ''), 'unix_socket' => env('DB_SOCKET', ''), 'charset' => 'utf8mb4', 'collation' => 'utf8mb4_unicode_ci', 'prefix' => '', 'strict' => true, 'engine' => null, ],et quand j'exécute je rencontre cette erreur :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35 <?php use Illuminate\Support\Facades\Schema; use Illuminate\Database\Schema\Blueprint; use Illuminate\Database\Migrations\Migration; class CreateEventTable extends Migration { /** * Run the migrations. * * @return void */ public function up() { Schema::create('events', function (Blueprint $table) { $table->increments('id'); $table->string('name'); $table->text('description'); $table->string('location'); $table->decimal('price',5,2); $table->timestamps(); }); } /** * Reverse the migrations. * * @return void */ public function down() { Schema::dropIfExists('events'); } }
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23 Illuminate\Database\QueryException : could not find driver (SQL: select * from information_schema.tables where table_schema = events and table_name = migrations) at F:\Laravel_projets\projet_events\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") F:\Laravel_projets\projet_events\vendor\laravel\framework\src\Illuminate\Database\Connectors\Connector.php:68 2 PDO::__construct("mysql:host=127.0.0.1;port=3306;dbname=events", "root", "mysql", []) F:\Laravel_projets\projet_events\vendor\laravel\framework\src\Illuminate\Database\Connectors\Connector.php:68 Please use the argument -v to see more details.
Partager