Skip to content
Advertisement

Database connection not configured

I am currently doing a local project, using MAMP with PHP version 7.4.21 and I can’t seem to run my system because the database is not configured correctly.

Here’s my .env

APP_NAME=Laravel
APP_ENV=local
APP_KEY=
APP_DEBUG=true
APP_URL=http://localhost:8888/VMLM

LOG_CHANNEL=stack
LOG_LEVEL=debug

DB_CONNECTION=vmlm
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=laravel
DB_USERNAME=root
DB_PASSWORD=

and here’s my database.php

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', 'localhost'),
        'port' => env('DB_PORT', '3306'),
        'database' => env('DB_DATABASE', 'vivemlm'),
        'username' => env('DB_USERNAME', 'admin'),
        'password' => env('DB_PASSWORD', 'admin'),
        'unix_socket' => env('DB_SOCKET', ''),
        'charset' => 'utf8mb4',
        'collation' => 'utf8mb4_unicode_ci',
        'prefix' => '',
        'prefix_indexes' => true,
        'strict' => false,
        'engine' => null,
        'options' => extension_loaded('pdo_mysql') ? array_filter([
            PDO::MYSQL_ATTR_SSL_CA => env('MYSQL_ATTR_SSL_CA'),
        ]) : [],
    ],

Advertisement

Answer

DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=vivemlm
DB_USERNAME=admin
DB_PASSWORD=admin

DB_CONNECTION is the driver that you will use

User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement