# Connect Laravel to SQLEye

> Set DB_CONNECTION, DB_HOST, DB_PORT, DB_DATABASE and DB_USERNAME in .env to use a SQLEye PostgreSQL or MySQL instance with Laravel.

Source: https://sqleye.com/docs/connect/laravel/ · Last updated: 2026-11-29 · Publisher: CodeROG (https://coderog.com)

Set the `DB_*` variables in your `.env` file. The instance's Info tab has a "Laravel .env" block you can copy.

## How do I configure PostgreSQL?

```ini
DB_CONNECTION=pgsql
DB_HOST=127.0.0.1
DB_PORT=5432
DB_DATABASE=myapp
DB_USERNAME=postgres
DB_PASSWORD=
```

## How do I configure MySQL?

```ini
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=myapp
DB_USERNAME=root
DB_PASSWORD=
```

Replace the port with your instance's port. Create the database first, see [CLI clients](/docs/connect/cli-clients/). Then run `php artisan migrate`.

Laravel's `config/database.php` reads these variables, and it also accepts a single `DB_URL` such as `mysql://root@127.0.0.1:3306/myapp` instead of separate values (its documented form is `driver://username:password@host:port/database`).

## Check the config

```bash
php artisan db:show
```

Source: [Laravel database docs](https://laravel.com/docs/12.x/database). To see the queries Laravel runs, including N+1 loops, [turn on capture](/docs/live-eye/capture/).
