# Connect Node.js (Prisma, Drizzle, Knex)

> Use a DATABASE_URL pointing at 127.0.0.1 with Prisma, Drizzle or Knex to connect Node.js to a SQLEye PostgreSQL or MySQL instance.

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

All three tools take the instance's host, port and user. Create the database first, see [CLI clients](/docs/connect/cli-clients/). Replace the ports below with your instance's port.

PostgreSQL:

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

MySQL:

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

## How do I use Prisma?

In the Prisma ORM 7 documentation the schema has only the provider, and the URL is set in `prisma.config.ts`.

```prisma
datasource db {
  provider = "postgresql" // or "mysql"
}
```

```ts
import { defineConfig, env } from "prisma/config";

export default defineConfig({
  schema: "prisma/schema.prisma",
  datasource: {
    url: env("DATABASE_URL"),
  },
});
```

Prisma's docs show the URL form `mysql://user:pass@host:3306/database`. Leave out the password for SQLEye.

## How do I use Drizzle?

`drizzle.config.ts` for PostgreSQL:

```ts
import { defineConfig } from 'drizzle-kit';

export default defineConfig({
  schema: './src/db/schema.ts',
  out: './drizzle',
  dialect: 'postgresql',
  dbCredentials: {
    url: process.env.DATABASE_URL!,
  },
});
```

For MySQL set `dialect: 'mysql'`. At runtime, `drizzle(process.env.DATABASE_URL!)` takes the same URL (the PostgreSQL guide installs `pg`, the MySQL guide `mysql2`).

## How do I use Knex?

Install `pg` for PostgreSQL or `mysql2` for MySQL.

```js
const knex = require('knex')({
  client: 'pg', // 'mysql2' for MySQL
  connection: {
    host: '127.0.0.1',
    port: 5432, // 3306 for MySQL
    user: 'postgres', // 'root' for MySQL
    database: 'myapp',
  },
});
```

Sources: [Prisma MySQL](https://prisma.io/docs/orm/overview/databases/mysql), [Drizzle PostgreSQL](https://orm.drizzle.team/docs/get-started/postgresql-new), [Drizzle MySQL](https://orm.drizzle.team/docs/get-started/mysql-new), [Knex](https://knexjs.org/guide/). To see the queries these tools send, [turn on capture](/docs/live-eye/capture/).
