php laravel artisan migrate error in model? - php

i am new to php laravel i try to migrate project with database but i got following error ?
Illuminate\Database\QueryException
could not find driver (SQL: select * from information_schema.tables where table_schema = lcrud and table_name = migrations and table_type = 'BASE TABLE')
at vendor/laravel/framework/src/Illuminate/Database/Connection.php:669
665| // If an exception occurs when attempting to run a query, we'll format the error
666| // message to include the bindings with SQL, which will make this exception a
667| // lot more helpful to the developer instead of just the database's errors.
668| catch (Exception $e) {
> 669| throw new QueryException(
670| $query, $this->prepareBindings($bindings), $e
671| );
672| }
673|
+34 vendor frames
35 artisan:37
Illuminate\Foundation\Console\Kernel::handle(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
and here is the .env file
APP_NAME=lcrud
APP_ENV=local
APP_KEY=base64:PchgVozhfLeJtzlwFMtY0VGEpsfj2PYCtS7eVcothEY=
APP_DEBUG=true
APP_URL=http://localhost
LOG_CHANNEL=stack
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=lcrud
DB_USERNAME=root
DB_PASSWORD=
BROADCAST_DRIVER=log
CACHE_DRIVER=file
QUEUE_CONNECTION=sync
SESSION_DRIVER=file
SESSION_LIFETIME=120
REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379
MAIL_MAILER=smtp
MAIL_HOST=smtp.mailtrap.io
MAIL_PORT=2525
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null
MAIL_FROM_ADDRESS=null
MAIL_FROM_NAME="${APP_NAME}"
AWS_ACCESS_KEY_ID=
AWS_SECRET_ACCESS_KEY=
AWS_DEFAULT_REGION=us-east-1
AWS_BUCKET=
PUSHER_APP_ID=
PUSHER_APP_KEY=
PUSHER_APP_SECRET=
PUSHER_APP_CLUSTER=mt1
MIX_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
MIX_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"
i have double check that my password is nothing so i have tried to place empty string like this DB_PASSWORD='' and also like this DB_PASSWORD=' ' but it does not work also in other stackoverflow question i read about php.ini file and made changes according this page.
my php version is PHP 7.2.24-0ubuntu0.19.04.2 (cli) (built: Jan 14 2020 13:26:02) ( NTS )
and when i type which php in terminal i got /usr/bin/php
i was trying other question answer but not working .
Please help me , Thank You .
UPDATE
here i have my database.php file that might help you ,
'connections' => [
'sqlite' => [
'driver' => 'sqlite',
'url' => env('DATABASE_URL'),
'database' => env('DB_DATABASE', database_path('database.sqlite')),
'prefix' => '',
'foreign_key_constraints' => env('DB_FOREIGN_KEYS', true),
],
'mysql' => [
'driver' => 'mysql',
'url' => env('DATABASE_URL'),
'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' => '',
'prefix_indexes' => true,
'strict' => true,
'engine' => null,
'options' => extension_loaded('pdo_mysql') ? array_filter([
PDO::MYSQL_ATTR_SSL_CA => env('MYSQL_ATTR_SSL_CA'),
]) : [],
],
'pgsql' => [
'driver' => 'pgsql',
'url' => env('DATABASE_URL'),
'host' => env('DB_HOST', '127.0.0.1'),
'port' => env('DB_PORT', '5432'),
'database' => env('DB_DATABASE', 'forge'),
'username' => env('DB_USERNAME', 'forge'),
'password' => env('DB_PASSWORD', ''),
'charset' => 'utf8',
'prefix' => '',
'prefix_indexes' => true,
'schema' => 'public',
'sslmode' => 'prefer',
],
'sqlsrv' => [
'driver' => 'sqlsrv',
'url' => env('DATABASE_URL'),
'host' => env('DB_HOST', 'localhost'),
'port' => env('DB_PORT', '1433'),
'database' => env('DB_DATABASE', 'forge'),
'username' => env('DB_USERNAME', 'forge'),
'password' => env('DB_PASSWORD', ''),
'charset' => 'utf8',
'prefix' => '',
'prefix_indexes' => true,
],
],

You get this error because there is no mysql server driver. you can try it by install it with use of below commands.
sudo apt-get install mysql-server php7.1-mysql
sudo service apache2 restart
sudo service mysql restart
Hope this will help you.

"lcrud" database exist ?
or
php artisan config:clear
php artisan cache:clear

I think can you missing php7.x-mysql
You can run:
php -v
For example Output: PHP 7.1
sudo apt-get install php7.1-mysql
Update:
PHP 7 is not available for Ubuntu Trusty in the standard Ubuntu repositories (2016-01-02).
You could use the PPA ppa:ondrej/php.
sudo apt-add-repository ppa:ondrej/php
sudo apt-get update
sudo apt-get install php7.1-fpm
sudo apt-get install php7.1-mysql
sudo service apache2 restart

Related

PDOException::("could not find driver") PHP Configuration MySql [duplicate]

This question already has answers here:
PDOException “could not find driver”
(42 answers)
Closed 3 years ago.
Just started exploring Laravel.
I created a fresh project from start. When trying to run php artisan migrate command I am getting this error:
Illuminate\Database\QueryException : could not find driver (SQL: select * from information_schema.tables where table_schema = laravel and table_name
= migrations and table_type = 'BASE TABLE')
at C:\xampp\htdocs\TestLaravelApp\vendor\laravel\framework\src\Illuminate\Database\Connection.php:665
661| // If an exception occurs when attempting to run a query, we'll format the error
662| // message to include the bindings with SQL, which will make this exception a
663| // lot more helpful to the developer instead of just the database's errors.
664|
catch (Exception $e) {
> 665| throw new QueryException(
666| $query, $this->prepareBindings($bindings), $e
667| );
668| }
669|
Exception trace:
1 PDOException::("could not find driver")
C:\xampp\htdocs\TestLaravelApp\vendor\laravel\framework\src\Illuminate\Database\Connectors\Connector.php:70
2 PDO::__construct("mysql:host=127.0.0.1;port=3306;dbname=laravel", "root", "", [])
C:\xampp\htdocs\TestLaravelApp\vendor\laravel\framework\src\Illuminate\Database\Connectors\Connector.php:70
Please use the argument -v to see more details.
My database.php file:
<?php
use Illuminate\Support\Str;
return [
/*
|--------------------------------------------------------------------------
| Default Database Connection Name
|--------------------------------------------------------------------------
|
| Here you may specify which of the database connections below you wish
| to use as your default connection for all database work. Of course
| you may use many connections at once using the Database library.
|
*/
'default' => env('DB_CONNECTION', 'mysql'),
/*
|--------------------------------------------------------------------------
| Database Connections
|--------------------------------------------------------------------------
|
| Here are each of the database connections setup for your application.
| Of course, examples of configuring each database platform that is
| supported by Laravel is shown below to make development simple.
|
|
| All database work in Laravel is done through the PHP PDO facilities
| so make sure you have the driver for your particular database of
| choice installed on your machine before you begin development.
|
*/
'connections' => [
'sqlite' => [
'driver' => 'sqlite',
'url' => env('DATABASE_URL'),
'database' => env('DB_DATABASE', database_path('database.sqlite')),
'prefix' => '',
'foreign_key_constraints' => env('DB_FOREIGN_KEYS', true),
],
'mysql' => [
'driver' => 'mysql',
'url' => env('DATABASE_URL'),
'host' => env('DB_HOST', '127.0.0.1'),
'port' => env('DB_PORT', '3306'),
'database' => env('DB_DATABASE', 'laravel'),
'username' => env('DB_USERNAME', 'root'),
'password' => env('DB_PASSWORD', ''),
'unix_socket' => env('DB_SOCKET', ''),
'charset' => 'utf8mb4',
'collation' => 'utf8mb4_unicode_ci',
'prefix' => '',
'prefix_indexes' => true,
'strict' => true,
'engine' => null,
'options' => extension_loaded('pdo_mysql') ? array_filter([
PDO::MYSQL_ATTR_SSL_CA => env('MYSQL_ATTR_SSL_CA'),
]) : [],
],
'pgsql' => [
'driver' => 'pgsql',
'url' => env('DATABASE_URL'),
'host' => env('DB_HOST', '127.0.0.1'),
'port' => env('DB_PORT', '5432'),
'database' => env('DB_DATABASE', 'forge'),
'username' => env('DB_USERNAME', 'forge'),
'password' => env('DB_PASSWORD', ''),
'charset' => 'utf8',
'prefix' => '',
'prefix_indexes' => true,
'schema' => 'public',
'sslmode' => 'prefer',
],
'sqlsrv' => [
'driver' => 'sqlsrv',
'url' => env('DATABASE_URL'),
'host' => env('DB_HOST', 'localhost'),
'port' => env('DB_PORT', '1433'),
'database' => env('DB_DATABASE', 'forge'),
'username' => env('DB_USERNAME', 'forge'),
'password' => env('DB_PASSWORD', ''),
'charset' => 'utf8',
'prefix' => '',
'prefix_indexes' => true,
],
],
/*
|--------------------------------------------------------------------------
| Migration Repository Table
|--------------------------------------------------------------------------
|
| This table keeps track of all the migrations that have already run for
| your application. Using this information, we can determine which of
| the migrations on disk haven't actually been run in the database.
|
*/
'migrations' => 'migrations',
/*
|--------------------------------------------------------------------------
| Redis Databases
|--------------------------------------------------------------------------
|
| Redis is an open source, fast, and advanced key-value store that also
| provides a richer body of commands than a typical key-value system
| such as APC or Memcached. Laravel makes it easy to dig right in.
|
*/
'redis' => [
'client' => env('REDIS_CLIENT', 'phpredis'),
'options' => [
'cluster' => env('REDIS_CLUSTER', 'redis'),
'prefix' => env('REDIS_PREFIX', Str::slug(env('APP_NAME', 'laravel'), '_').'_database_'),
],
'default' => [
'url' => env('REDIS_URL'),
'host' => env('REDIS_HOST', '127.0.0.1'),
'password' => env('REDIS_PASSWORD', null),
'port' => env('REDIS_PORT', 6379),
'database' => env('REDIS_DB', 0),
],
'cache' => [
'url' => env('REDIS_URL'),
'host' => env('REDIS_HOST', '127.0.0.1'),
'password' => env('REDIS_PASSWORD', null),
'port' => env('REDIS_PORT', 6379),
'database' => env('REDIS_CACHE_DB', 1),
],
],
];
My .env file:
APP_NAME=Laravel
APP_ENV=local
APP_KEY=base64:CzpqNscMHgrAu1ctWWWrvj3x5dT7ak/NHFI774evggU=
APP_DEBUG=true
APP_URL=http://localhost
LOG_CHANNEL=stack
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=laravel
DB_USERNAME=root
DB_PASSWORD=
BROADCAST_DRIVER=log
CACHE_DRIVER=file
QUEUE_CONNECTION=sync
SESSION_DRIVER=file
SESSION_LIFETIME=120
REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379
MAIL_DRIVER=smtp
MAIL_HOST=smtp.mailtrap.io
MAIL_PORT=2525
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null
AWS_ACCESS_KEY_ID=
AWS_SECRET_ACCESS_KEY=
AWS_DEFAULT_REGION=us-east-1
AWS_BUCKET=
PUSHER_APP_ID=
PUSHER_APP_KEY=
PUSHER_APP_SECRET=
PUSHER_APP_CLUSTER=mt1
MIX_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
MIX_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"
Php Version:
PHP 7.3.10 (cli) (built: Sep 24 2019 11:59:22) ( ZTS MSVC15 (Visual C++ 2017) x64 )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.3.10, Copyright (c) 1998-2018 Zend Technologies
/**PHP.ini*/
; Directory in which the loadable extensions (modules) reside.
; http://php.net/extension-dir
; extension_dir = "./"
; On windows:
extension_dir="C:/xampp/php/ext"
extension=php_bz2.dll
extension=php_curl.dll
extension=php_fileinfo.dll
;extension=php_ftp.dll
extension=php_gd2.dll
extension=php_gettext.dll
;extension=php_gmp.dll
;extension=php_intl.dll
;extension=php_imap.dll
;extension=php_interbase.dll
;extension=php_ldap.dll
extension=php_mbstring.dll
extension=php_exif.dll ; Must be after mbstring as it depends on it
extension=php_mysqli.dll
;extension=php_oci8_12c.dll ; Use with Oracle Database 12c Instant Client
;extension=php_odbc.dll
;extension=php_openssl.dll
;extension=php_pdo_firebird.dll
extension=php_pdo_mysql.dll
;extension=php_pdo_oci.dll
;extension=php_pdo_odbc.dll
;extension=php_pdo_pgsql.dll
extension=php_pdo_sqlite.dll
;extension=php_pgsql.dll
;extension=php_shmop.dll
I have tried all possible solution present in stackoverflow.
may be I am missing something.
URL for php.ini file I am using: https://stackblitz.com/edit/angular-ptnqax
Thanks
Finally was able to figure it out my self. While changing configuration in php.ini file which is in xampp folder I also modified the file in php installed location .ini file. reverting back the changes worked.
You need to have a module called pdo_mysql. Check in php.ini file
Try uncommenting this line from php.ini. JUst remove ; from that line save file and restart your server.
extension=pdo_mysql
Try adding this line in php.ini file
extension=php_pdo_mysql.so

How to fix migrate Laravel error 'PDOException and PDO::__construct'

I'm trying to execute the php artisan migrate command to create a table in phpmyadmin
But its showing error of
"could not find driver"
I have made the php artisan serve and it worked
'mysql' => [
'driver' => 'mysql',
'host' => env('DB_HOST', '127.0.0.1'),
'port' => env('DB_PORT', '3306'),
'database' => env('DB_DATABASE', 'testdb'),
'username' => env('DB_USERNAME', 'root'),
'password' => env('DB_PASSWORD', 'xxxx'),
'unix_socket' => env('DB_SOCKET', ''),
'charset' => 'utf8mb4',
'collation' => 'utf8mb4_unicode_ci',
'prefix' => '',
'prefix_indexes' => true,
'strict' => true,
'engine' => null,
'options' => extension_loaded('pdo_mysql') ? array_filter([
PDO::MYSQL_ATTR_SSL_CA => env('MYSQL_ATTR_SSL_CA'),
]) : [],
],
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=testdb
DB_USERNAME=root
DB_PASSWORD=xxxx
This is the error showing in the command line:
Illuminate\Database\QueryException : could not find driver
(SQL: select * from information_schema.tables where table_schema =
testdb and table_name = migrations)
at C:\AppServ\www\laravel2\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")
C:\AppServ\www\laravel2\vendor\laravel\framework\src\Illuminate\Database\Connectors\Connector.php:70
2 PDO::__construct("mysql:host=127.0.0.1;port=3306;dbname=testdb", "root", "xxxx", [])
C:\AppServ\www\laravel2\vendor\laravel\framework\src\Illuminate\Database\Connectors\Connector.php:70
it's expected to show "tables created successfully" and also created in phpmyadmin
Make sure the mysql is running on your machine if you're using homestead mysql port might be 33060 ..
to clarify if mysql is running open the terminal on mac or linux or command line on windows and write
mysql -u root
if you got the error that mean the mysql is not running.
You are missing the php-mysql driver for PHP, you can check it by executing php -i | grep mysql
If you are missing it you have to install it considering your system type, for example if you were working on a php7.2 system on ubuntu, you should do:
sudo apt-get install php7.2-mysql
Change in config/database.php file according to this:
'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' => '',
'prefix_indexes' => true,
'strict' => true,
'engine' => null,
'options' => extension_loaded('pdo_mysql') ? array_filter([
PDO::MYSQL_ATTR_SSL_CA => env('MYSQL_ATTR_SSL_CA'),
]) : [],
],
Check here : Link
Open the .env file and edit it. just set up correct database credentials
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE= // Your Database Name
DB_USERNAME= // Your Database Username
DB_PASSWORD= // Your Database Password, If no password is set then just clear it
After .env edit, must be clear cache: php artisan config:cache

Setup Travis-CI with Laravel 5 and PostgreSQL

After migrating from MySQL to PostgreSQL, I've been having problems integrating Laravel 5.1 with Travis-CI. I've tried the following configuration:
.env.travis
APP_ENV=local
APP_DEBUG=true
APP_KEY=SomeRandomString
DB_CONNECTION=pgsql
DB_HOST=127.0.0.1
DB_DATABASE=CDJ_BD
DB_USERNAME=postgres
DB_PASSWORD=
CACHE_DRIVER=file
SESSION_DRIVER=file
QUEUE_DRIVER=sync
REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379
MAIL_DRIVER=smtp
MAIL_HOST=mailtrap.io
MAIL_PORT=2525
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null
.travis.yml
language: php
php:
- 7.0
addons:
postgresql: "9.4"
before_install:
- composer self-update
- cp .env.travis .env
- psql -c 'create database CDJ_BD;' -U postgres
install:
- composer require phpunit/phpunit:4.8.* satooshi/php-coveralls:dev-master
- composer install --dev
script:
- php artisan migrate --seed
- ./vendor/bin/phpunit --coverage-clover ./tests/logs/clover.xml
after_script:
- php vendor/bin/coveralls -v
database.php
...
'default' => env('DB_CONNECTION', 'pgsql'),
'connections' => [
'testing' => [
'driver' => 'pgsql',
'host' => env('DB_HOST', 'localhost'),
'database' => env('DB_DATABASE', 'CDJ_BD'),
'username' => env('DB_USERNAME', 'postgres'),
'password' => env('DB_PASSWORD', ''),
'charset' => 'utf8',
'prefix' => '',
'schema' => 'public',
],
'pgsql' => [
'driver' => 'pgsql',
'host' => env('DB_HOST', 'localhost'),
'database' => env('DB_DATABASE', 'CDJ_BD'),
'username' => env('DB_USERNAME', 'postgres'),
'password' => env('DB_PASSWORD', ''),
'charset' => 'utf8',
'prefix' => '',
'schema' => 'public',
],
],
...
After running php artisan migrate --seed, the following exception is thrown:
[PDOException]
SQLSTATE[08006] [7] FATAL: database "CDJ_BD" does not exist
My MySQL configuration was pretty similar and ran without any problems. Any suggestions on how to resolve this issue?
Thanks.
As suggested in the comments by wildplasser, the problem was the CAPS database name in env('DB_DATABASE', 'CDJ_BD'), in database.php and in the .travis files. Switching them all to lowercase 'cdj_bd' solved the problem.

php artisan migrate:install won't work

I just started downloading laravel 5 today. Where I install my laravel in my desktop. When I try to create a database using laravel comman php artisan migrate:install and it give's me a error SQLSTATE[HY000] [1044] Access denied for user ''#'localhost' to database 'forge' I tried a lot of examples on google but didn't work for me.
I follow on of the steps on the internet where I configure my .env file followed the array contain in database.php database to 'forge', username to 'forge' and password to ''
database.php
'connections' => [
'sqlite' => [
'driver' => 'sqlite',
'database' => env('DB_DATABASE', database_path('database.sqlite')),
'prefix' => '',
],
'mysql' => [
'driver' => 'mysql',
'host' => env('DB_HOST', 'localhost'),
'port' => env('DB_PORT', '3306'),
'database' => env('DB_DATABASE', 'forge'),
'username' => env('DB_USERNAME', 'forge'),
'password' => env('DB_PASSWORD', ''),
'charset' => 'utf8',
'collation' => 'utf8_unicode_ci',
'prefix' => '',
'strict' => false,
'engine' => null,
],
'pgsql' => [
'driver' => 'pgsql',
'host' => env('DB_HOST', 'localhost'),
'port' => env('DB_PORT', '5432'),
'database' => env('DB_DATABASE', 'forge'),
'username' => env('DB_USERNAME', 'forge'),
'password' => env('DB_PASSWORD', ''),
'charset' => 'utf8',
'prefix' => '',
'schema' => 'public',
],
],
.env
APP_ENV=local
APP_DEBUG=true
APP_KEY=base64:oqZ6S+IZANLCbszbhef9VSPqd/4rw22oT0mixzsflZo=
APP_URL=http://localhost
DB_CONNECTION=mysql
DB_HOST=localhost
DB_PORT=3306
DB_DATABASE=forge
DB_USERNAME=forge
DB_PASSWORD=''
CACHE_DRIVER=file
SESSION_DRIVER=file
QUEUE_DRIVER=sync
REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379
MAIL_DRIVER=smtp
MAIL_HOST=mailtrap.io
MAIL_PORT=2525
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null
How can I create database just typing php artisan migrate:install and automatically create laravel_migration database in my localhost? Just saw this on the internet. But when I did this it didn't create for me.
As mentioned in the comments, the tutorial assumes you are using their development virtual machine. Since you're not, you need to start up MySQL and do the following:
CREATE DATABASE IF NOT EXISTS forge;
CREATE USER forge#localhost IDENTIFIED BY '';
GRANT ALL PRIVILEGES ON forge.* TO forge#localhost;
Once the database and user are created, you should be good to go. This should be part of their documentation...

Laravel 5: Error: "Driver not found" while migrating the database(mysql) in laravel

It's been around 5-6 hours since I've been trying to use database in laravel 5.
I've gone through of videos and it confused me a lot.
I have created the model and migration but when i try to migrate it gives me an
[ PDOException ] Driver not found
I've made numerous changes to .env and database.php but nothing works.
I am using laravel 5 with xampp server.
Kindly help
Thank you
.env file
APP_ENV=local
APP_DEBUG=true
APP_KEY=zZfvju3BKjxmLKbl5gsVJ3ymkIvHbGNq
DB_CONNECTION=mysql
DB_HOST=localhost
DB_PORT=3306
DB_DATABASE=medicaldb
DB_USERNAME=root
DB_PASSWORD=
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
database.php file
<?php
return [
'fetch' => PDO::FETCH_CLASS,
'default' => env('DB_CONNECTION', 'mysql'),
'connections' => [
'sqlite' => [
'driver' => 'sqlite',
'database' => env('DB_DATABASE', database_path('database.sqlite')),
'prefix' => '',
],
'mysql' => [
'driver' => 'mysql',
'host' => env('DB_HOST', 'localhost'),
'port' => env('DB_PORT', '3306'),
'database' => env('DB_DATABASE', 'medicaldb'),
'username' => env('DB_USERNAME', 'root'),
'password' => env('DB_PASSWORD', ''),
'charset' => 'utf8',
'collation' => 'utf8_unicode_ci',
'prefix' => '',
'strict' => false,
'engine' => null,
],
'pgsql' => [
'driver' => 'pgsql',
'host' => env('DB_HOST', 'localhost'),
'port' => env('DB_PORT', '5432'),
'database' => env('DB_DATABASE', 'forge'),
'username' => env('DB_USERNAME', 'forge'),
'password' => env('DB_PASSWORD', ''),
'charset' => 'utf8',
'prefix' => '',
'schema' => 'public',
],
],
'migrations' => 'migrations',
'redis' => [
'cluster' => false,
'default' => [
'host' => env('REDIS_HOST', 'localhost'),
'password' => env('REDIS_PASSWORD', null),
'port' => env('REDIS_PORT', 6379),
'database' => 0,
],
],
];
Finally, at last! it worked!!
In php.ini file:
(semi-colon) ; works as a single-line comment in php.ini file.
(semi-colon) was added at the beginning of the line - which disables pdo mysql driver.
I just needed to remove the semi-colon(;) to enable mysql, from the beginning of the line.
Same problem, ubuntu 17.10, Laravel 5.6
It is the issue normally come when you upgrade you php version I get the same issues in my lammp stack while i update from php 7 to 7.1 I get Solve by following command
Open Terminal
sudo apt install php7.1-pdo php7.1-mysql
Have fun with Code
Are you sure you have mysql intalled? also, please check pdo_mysql module is enabled. use phpinfo();

Categories