FG
๐Ÿ’ป Software๐Ÿ—„๏ธ Databases

[BUG]: drizzle-kit push:mysql throws error with only connectionString

Fresh3 days ago
Mar 14, 20260 views
Confidence Score55%
55%

Problem

What version of `drizzle-orm` are you using? 0.26.1 What version of `drizzle-kit` are you using? 0.18.1 Describe the Bug When I try to migrate (push) my schema to my DB it throws an error `Error: Either `connectionString` or `host, port, etc.` params be provided in config file`. [code block] [code block] However I specified the connectionString... Am I doing something wrong here? Expected behavior It should push to db if I declared connectionString Environment & setup _No response_

Error Output

error `Error: Either `connectionString` or `host, port, etc.` params be provided in config file`.

Unverified for your environment

Select your OS to check compatibility.

1 Fix

Canonical Fix
Unverified Fix
New Fix โ€“ Awaiting Verification

Fix connectionString issue in drizzle-kit migration

Medium Risk

The error occurs because the drizzle-kit migration process expects a specific format for the connection string or additional parameters (host, port, etc.) to be provided in the configuration file. The provided connection string may not be recognized due to formatting issues or missing required parameters.

Awaiting Verification

Be the first to verify this fix

  1. 1

    Verify connectionString format

    Ensure that the connectionString is correctly formatted according to the database requirements. It should include all necessary components such as username, password, host, port, and database name.

    typescript
    const connectionString = 'mysql://user:password@localhost:3306/database';
  2. 2

    Check configuration file

    Open your drizzle-kit configuration file (e.g., drizzle.config.ts) and confirm that the connectionString is correctly specified. Ensure there are no typos or syntax errors.

    typescript
    export default { connectionString: 'mysql://user:password@localhost:3306/database' };
  3. 3

    Update drizzle-kit version

    Consider updating drizzle-kit to the latest version if you are not using the latest one. This can resolve compatibility issues and bugs that may exist in older versions.

    bash
    npm install drizzle-kit@latest
  4. 4

    Test migration command

    Run the migration command again after making the above changes to see if the issue is resolved. Use the command: `npx drizzle-kit push:mysql`.

    bash
    npx drizzle-kit push:mysql
  5. 5

    Fallback to host/port parameters

    If the issue persists, as a temporary workaround, specify the database connection using host, port, username, and password instead of the connectionString.

    typescript
    export default { host: 'localhost', port: 3306, user: 'user', password: 'password', database: 'database' };

Validation

Confirm the fix worked by successfully running the migration command without errors. The database schema should be updated as expected.

Sign in to verify this fix

Environment

Submitted by

AC

Alex Chen

2450 rep

Tags

drizzleormtypescriptbug