1
'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' => '',
        'strict' => true,
        'engine' => null,
    ],

Wampserver version: 3.2.0 ; MySQL Version: 8.0.18 Port defined for MariaDB: 3307 ; PHP Version 7.3.12 - Port defined for MySQL: 3308 In .env file

DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3308
DB_DATABASE=bpl
DB_USERNAME=root
DB_PASSWORD=abc2014

I tried many things to solve, but either way I am getting error connecting the database in Laravel. I am facing this problem in migration while running the command:

php artisan migrate
Dharman
  • 30,962
  • 25
  • 85
  • 135
Manan
  • 394
  • 4
  • 15
  • check the database charset – Alberto Sinigaglia Dec 15 '19 at 23:53
  • see this question might help you :https://stackoverflow.com/questions/51051440/server-sent-charset-255-unknown-to-the-client-set-mysql-charset-to-utf8-w-o –  Dec 16 '19 at 00:01
  • I solved with with xampp. I was using wampserver. I think the main cause is the default port number. in wamp the default port is 3308, on the other hand, the default port in xampp is 3306. Though i also tried it by changing the port number, I could not solve the problem. I have also changed the charset and collation with respect to database. But it didn't solve. However, I could not find the reason of getting error. – Manan Dec 16 '19 at 07:23

0 Answers0