Support socket path drizzle.config.ts

Hey, I have been prototyping my database in a local environment using mysql2. Everything is compatible with drizzle apart from drizzle studio. In the db credentials object, there doesn't seem to be an option to specify socketPath like there is in the native mysql2 object.

import type { Config } from "drizzle-kit";
import * as dotenv from "dotenv";

dotenv.config({
  path: ".env",
});

export default {
  schema: "src/db/schema.ts",
  driver: "mysql2",
  out: "src/db",
  verbose: true,

  dbCredentials: {
    //@ts-ignore
    socketPath: process.env.DB_SOCKET_PATH as string,
    host: "127.0.0.1",
    uri: process.env.DB_URL as string,
  },
  strict: true,
  tablesFilter: [`${process.env.DB_TABLES_FILTER as string}*`],

  breakpoints: true,
} satisfies Config;


as a result, studio can't connect to the database (ECONNREFUSED ::1:3306)
Was this page helpful?