0
votes

when I use this php artisan migrate command, I got this error:

[Illuminate\Database\QueryException] could not find driver (SQL: select * from information_schema.tables where table_schema = laravelcrud and t able_name = migrations)

PDOException could not find driver

my .env file

DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=laravelcrud
DB_USERNAME=root
DB_PASSWORD=root
2

2 Answers

1
votes

Running sudo apt-get install php7.0-mysql will help you to fix this problem (just change the php version to the right version and then run it) for example if you are using php 7.2 just run this

sudo apt-get install php7.2-mysql
0
votes

First check if you have pdo_mysql, mysqli and mysqlnd driver. Run the following command in terminal:

php -m | grep mysql

If the said modules are not available, then

sudo apt install php7.4-mysql