# Connect Rails to SQLEye

> Point Rails at a SQLEye PostgreSQL or MySQL instance with a DATABASE_URL using 127.0.0.1, the instance port and no password.

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

Set `DATABASE_URL` to the instance's URL. Rails documents the `postgresql` adapter for PostgreSQL and `mysql2` for MySQL, and a `mysql://` URL maps to `mysql2`.

## How do I configure PostgreSQL?

```bash
export DATABASE_URL="postgresql://postgres@127.0.0.1:5432/myapp"
```

## How do I configure MySQL?

```bash
export DATABASE_URL="mysql://root@127.0.0.1:3306/myapp"
```

Replace the port with your instance's port. If your client requires a password field, leave it empty.

## How do I create the database?

Create it with the [CLI clients](/docs/connect/cli-clients/) before running your migrations.

Source: [Rails configuring guide](https://guides.rubyonrails.org/configuring.html#configuring-a-database). To spot N+1 loads in your Active Record code, [turn on capture](/docs/live-eye/capture/).
