I am trying to install Laravel. I have installed Xampp
, but when I try to setup my database using php artisan migrate
I get the error:
In your php.ini configuration file simply uncomment the extension:
;extension=php_pdo_mysql.dll
(You can find your php.ini file in the php folder where your stack server is installed.)
If you're on Windows make it: extension=php_pdo_mysql.dll
If you're on Linux make it: extension=pdo_mysql.so
And do a quick server restart.
If this isn't working for you, you may need to install pdo_mysql extension into your php library.
I am a Windows and XAMPP user. What works for me is adding extension=php_pdo_mysql.dll
in both php.ini
of XAMPP and php.ini
in C:\php\php.ini
.
Run this command in your cmd to know where your config file is
php -i | find /i "Configuration File
If you are on linux systems
please try running sudo php artisan migrate
As for me,sometimes database operations need to run with sudo in laravel.
whilst sometimes you might have multiple php versions, you might also have a held-back version of php-mysql.. do a sudo dpkg -l | grep mysql | grep php and compare what you get from php -v
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=shreemad
DB_USERNAME=root
DB_PASSWORD=
Change the DB_PASSWORD field to
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=shreemad
DB_USERNAME=root
DB_PASSWORD=" "
In my case it works