gitscrum-team / laravel-gitscrum

GitScrum is a Project Management Tool, developed to help entrepreneurs, freelancers, managers, and teams Skyrocket their Productivity with the Agile methodology and Gamification.
https://site.gitscrum.com
MIT License
2.89k stars 727 forks source link

DB connection failed #348

Open gkjangid opened 4 years ago

gkjangid commented 4 years ago

My .ENV file DB_CONNECTION=mysql DB_HOST=localhost DB_PORT=3306 DB_DATABASE=gitscrumorion DB_USERNAME=gitscrumorionkp DB_PASSWORD=gitscrumorionkp_321

But Db connected Screenshot from 2020-07-07 11-59-50

nyrnzn commented 4 years ago

@gkjangid can you show the content of your database.php file in the config folder?

gkjangid commented 4 years ago

Database.php

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

    'mysql' => [
        'driver' => 'mysql',
        'host' => env('DB_HOST', 'localhost'),
        'port' => env('DB_PORT', '3306'),
        'database' => env('gitscrumorion'),
        'username' => env('gitscrumorionkp'),
        'password' => env('gitscrumorionkp_321'),
        'charset' => 'utf8',
        'collation' => 'utf8_unicode_ci',
        'prefix' => '',
        'strict' => true,
        'engine' => null,
    ]

],
nyrnzn commented 4 years ago

Update your database.php file 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' => env('DB_PREFIX'),
            'strict' => false,
            'engine' => 'InnoDB ROW_FORMAT=DYNAMIC',
        ],

You should not be changing anything on this file.

Basically, what happens is, in this statement, for example, 'database' => env('DB_DATABASE', 'forge'), env() takes two parameters,

Database.php

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

    'mysql' => [
        'driver' => 'mysql',
        'host' => env('DB_HOST', 'localhost'),
        'port' => env('DB_PORT', '3306'),
        'database' => env('gitscrumorion'),
        'username' => env('gitscrumorionkp'),
        'password' => env('gitscrumorionkp_321'),
        'charset' => 'utf8',
        'collation' => 'utf8_unicode_ci',
        'prefix' => '',
        'strict' => true,
        'engine' => null,
    ]

],
gkjangid commented 4 years ago

@nyrnzn Thanks dear But now i have some other issue i have only 14 tables are come Screenshot from 2020-07-07 15-24-47 Screenshot from 2020-07-07 15-25-01

armsasmart commented 4 years ago

you can add like this.

https://laravel.com/docs/8.x/migrations#indexes

AppServiceProvider.php

use Illuminate\Support\Facades\Schema;

/**
 * Bootstrap any application services.
 *
 * @return void
 */
public function boot()
{
    Schema::defaultStringLength(191);
}