Laravel 5 database issue

前端 未结 13 836
抹茶落季
抹茶落季 2020-12-15 04:24

I\'ve installed laravel 5 successfully by using this command:

composer create-project laravel/laravel test-laravel-5-project dev-develop --prefer-dist
         


        
13条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-15 05:10

    In Config->database.php

    'mysql' => [
            'driver' => 'mysql',
            'host' => env('DB_HOST', 'localhost'),
            'port' => env('DB_PORT', '3306'),
            'database' => env('DB_DATABASE', 'DBName'),
            'username' => env('DB_USERNAME', 'root'),
            'password' => env('DB_PASSWORD', ''),
            'charset' => 'utf8',
            'collation' => 'utf8_unicode_ci',
            'prefix' => '',
            'strict' => false,
            'engine' => null,
        ],
    

    In .env file :

    DB_HOST=localhost
    DB_PORT=3306
    DB_DATABASE=DBName
    DB_USERNAME=root
    DB_PASSWORD=
    

    Close the laravel application server and restart again for clearing the cache.

      php artisan serve
    

    Or you can do :

      php artisan config:clear
    

    This will clear the cache in config files.

    Now it will definitely work! Cheers!

提交回复
热议问题