duckdb_mysql icon indicating copy to clipboard operation
duckdb_mysql copied to clipboard

Can't connect to MySQL server

Open tm86 opened this issue 9 months ago • 1 comments

What happens?

Cannot create a connection to MySQL via secrets. trying to connect to 127.0.0.1 server instead of "reports-db.dev-office.local"

SQL Error: IO Error: Failed to connect to MySQL database with parameters "user="dev_user" password="pass4dev_user" host="reports-db.dev-office.local" port="3306" database="reports_dev" host=""": Can't connect to MySQL server on '127.0.0.1:3306' (61)

whereas without using secrets works fine

attach 'host=reports-db.dev-office.local user=dev_user password=pass4dev_user port=3306 database=reports_dev' as mysql_tm (type mysql);

To Reproduce

`drop secret if exists mysql_secret;

create or replace secret mysql_secret ( TYPE mysql, HOST 'reports-db.dev-office.local', PORT 3306, DATABASE reports_dev, USER 'dev_user', PASSWORD 'pass4dev_user' );

detach database if exists mysql_reports_rw;

attach '' as mysql_reports_rw (type mysql, SECRET mysql_secret); `

OS:

MacOS, Windows Server

MySQL Version:

8.0.37-29, 5.6.51-91.0

DuckDB Version:

v1.2.1 (osx_amd64)

DuckDB Client:

duckdb, DBEaver

Full Name:

Mykhailo T.

Affiliation:

tm86

Have you tried this on the latest main branch?

  • [x] I agree

Have you tried the steps to reproduce? Do they include all relevant data and configuration? Does the issue you report still appear there?

  • [x] I agree

tm86 avatar Mar 22 '25 12:03 tm86

+1 ... It looks like the host get overwritten with an empty string

hello-world-bfree avatar Mar 22 '25 22:03 hello-world-bfree

This should be solved by #122, I am getting the following output that looks correct to me (hostname parsed correctly):

Failed to connect to MySQL database with parameters "": Unknown server host 'reports-db.dev-office.local' (-3). Attempted host: reports-db.dev-office.local

Closing as completed, please comment if it needs to be reopened.

staticlibs avatar Nov 13 '25 19:11 staticlibs