build the application locally on my machine while
tapping into the database that is hosted.
You probably need to specify the ip address that the db is hosting on.
DB_HOST=localhost
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
Hello all,
I am new to Laravel and I have been learning this pretty well however I am stuck at a particular position, that position is to query the phpMyAdmin db. What I am attempting to do is to build the application locally on my machine while tapping into the database that is hosted.
I have done this through basic php but I'm getting a connection refused when loading the page.
Below is my .env and database.php files. I have removed the passwords in both for security reasons.
.env
APP_NAME=Laravel
APP_ENV=local
APP_KEY=base64:JJFkVL455YB+jkXul+x2C9hE7h+hSc/ww/ELNENDk88=
APP_DEBUG=true
APP_URL=http://localhost
LOG_CHANNEL=stack
DB_CONNECTION=mysql
DB_HOST=localhost
DB_PORT=3306
DB_DATABASE=taqiuddi_ball_hockey
DB_USERNAME=taqiuddin
DB_PASSWORD=*******
database.php
'default' => env('DB_CONNECTION', 'mysql'),
'mysql' => [
'driver' => 'mysql',
'host' => env('DB_HOST', 'localhost'),
'port' => env('DB_PORT', '3306'),
'database' => env('DB_DATABASE', 'taqiuddi_ball_hockey'),
'username' => env('DB_USERNAME', 'taqiuddin'),
'password' => env('DB_PASSWORD', *******),
'unix_socket' => env('DB_SOCKET', ''),
'charset' => 'utf8mb4',
'collation' => 'utf8mb4_unicode_ci',
'prefix' => '',
'strict' => true,
'engine' => null,
],
Please or to participate in this conversation.