0

I'm some kind of newbie in Laravel, so sorry for dumb questions. I installed XAMPP on my Ubuntu 16.04. And I created a Laravel project "myFirstProject" in the folder "/opt/lampp/htdocs/LaravelProjects". Now I'm trying to use this command

php artisan migrate

But it shows me an error

[Illuminate\Database\QueryException] could not find driver (SQL: select * from informat ion_schema.tables where table_schema = laravel_test and table_name = migrations)


[PDOException] could not find driver

How can I use mysql (which is installed with XAMPP) in my Laravel project?

Here is some code from .env file:

DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=laravel_test
DB_USERNAME=root
DB_PASSWORD=

And this is from database.php:

'default' => env('DB_CONNECTION', 'mysql'),
'mysql' => [
        'driver' => 'mysql',
        'host' => env('DB_HOST', '127.0.0.1'),
        'port' => env('DB_PORT', '3306'),
        'database' => env('DB_DATABASE', 'laravel_test'),
        'username' => env('DB_USERNAME', 'root'),
        'password' => env('DB_PASSWORD', ''),
        'unix_socket' => env('DB_SOCKET', ''),
        'charset' => 'utf8mb4',
        'collation' => 'utf8mb4_unicode_ci',
        'prefix' => '',
        'strict' => true,
        'engine' => null,
    ],
Alexander
  • 161
  • 2
  • 14
  • Read this too: http://stackoverflow.com/questions/22463614/php-artisan-migrate-throwing-pdo-exception-could-not-find-driver-using-larav – Sky May 13 '17 at 18:26
  • Did you start the mysql server?Did you create a db named laravel_test? – Mihai May 13 '17 at 18:26

1 Answers1

0

Try:

sudo apt-get install sqlite php5-sqlite php5-mysql 
sudo /etc/init.d/apache2 restart

If you're using php-fpm restart that too.

Sky
  • 4,244
  • 7
  • 54
  • 83