We use cookies
We use cookies to optimize our website. By continuing to browse the site, you agree to our use of cookies.
New design
Control panel
  • Русский
  • Українська
  • English
  • UAH
  • USD
  • RUB
  • EUR
  • 0-800-307-307 Hotline
  • +38 (044) 392-74-33 Kiev
  • +38 (057) 728-39-00 Kharkiv
  • +38 (056) 794-38-31 Dnipro
  • +38 (032) 229-58-93 Lviv
  • +38 (048) 738-57-70 Odessa
  • +38(093) 170-15-42  Life
  • +38 (067) 400-88-44 Kievstar
  • +1(888)393-24-51  USA, Toll free
  • +44(131)507-01-14  Great Britain
  • +7 (499) 348-28-61 Moscow

2.14.2.3. Setting up a database connection in Laravel

Data to connect to the database in Laravel are specified in the configuration file of the database settings:

  • In case of using a file .env you need to change the lines:
    DB_HOST=host DB_PORT=3306
    DB_DATABASE=base_DB data_USERNAME=login DB_PASSWORD=password
  • In case of using a file config/database.php you need to change the lines:
    'mysql' => [
        'driver' => 'mysql',
        'host' => env('DB_HOST', 'host'),
        'port' => env('DB_PORT', '3306'),
        'database' => env('DB_DATABASE', 'base_data'),
        'username' => env('DB_USERNAME', 'login'),
        'password' => env('DB_PASSWORD', 'password'),
        'unix_socket' => env('DB_SOCKET', ''),

Please note that after editing the configuration files, you may need to update the cache. The update is performed by the commands:

php artisan config:clear
php artisan config:cache

You can select the required PHP version by instructions.

You can make changes to files using file manager or any FTP client.