2

I just started to learn PHP. I'm following instructions in https://www.flynsarmy.com/2015/02/creating-a-basic-todo-application-in-laravel-5-part-1/

After I set up migration using

php artisan make:migration create_projects_and_tasks_tables --create="projects"

I edit /database/migrations/_create_projects_and_tasks_tables.php as it says. But when I tried to excute

php artisan migrate

I got [PDOException] could not find driver.

I'm running Laravel 5 on Ubuntu 14.04 LTS. I changed ~/'myProject'/config/database.php

'default' => env('DB_CONNECTION', 'mysql'),

to

'default' => 'mysql',

Here is my .env file

APP_ENV=local
APP_DEBUG=true
APP_KEY=RCUsYpBg6N0XFaax6BeaKSOCh1s5sNHy

DB_HOST=localhost
DB_DATABASE=homestead
DB_USERNAME=homestead
DB_PASSWORD=secret

CACHE_DRIVER=file
SESSION_DRIVER=file
QUEUE_DRIVER=sync

MAIL_DRIVER=smtp
MAIL_HOST=mailtrap.io
MAIL_PORT=2525
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null

The output of php --ini is

Configuration File (php.ini) Path: /etc/php5/cli
Loaded Configuration File:         /etc/php5/cli/php.ini
Scan for additional .ini files in: /etc/php5/cli/conf.d
Additional .ini files parsed:      /etc/php5/cli/conf.d/05-opcache.ini,
/etc/php5/cli/conf.d/10-pdo.ini,
/etc/php5/cli/conf.d/20-json.ini,
/etc/php5/cli/conf.d/20-mssql.ini,
/etc/php5/cli/conf.d/20-pdo_dblib.ini,
/etc/php5/cli/conf.d/20-readline.ini

I also installed php5-sybase package as Laravel 5: Artisan throw PDOException could not find driver suggested.

Any suggestion would be really appreciated. Thanks.

Edit 1

Ran php artisan migrate after installed php5-mysql [PDOException] SQLSTATE[28000] [1045] Access denied for user 'homestead'@'localhost' (using password: YES)

Edit 2

DB_USERNAME=homestead
DB_PASSWORD=secret

should be the actual username and password for mysql

Community
  • 1
  • 1
Daolin
  • 614
  • 1
  • 16
  • 41

0 Answers0