Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MySQL DSN with a port #32

Closed
weirdan opened this issue Aug 17, 2023 · 2 comments · Fixed by #35
Closed

MySQL DSN with a port #32

weirdan opened this issue Aug 17, 2023 · 2 comments · Fixed by #35

Comments

@weirdan
Copy link

weirdan commented Aug 17, 2023

I'm trying to connect to a MySQL server available on localhost on non-standard port.

I've tried the following DSNs (all fail):

  • user_name:pass_word@tcp(127.0.0.1:3308)/dbname
    Error  05:20:44 PM notify.error nvim-dbee mysql: invalid url: parse "user_name:pass_word@tcp(127.0.0.1:3308)/dbname": first path segment in URL cannot contain colon
    Error  05:20:44 PM notify.error nvim-dbee [handler]: .../share/lazynvim/lazy/nvim-dbee/lua/dbee/handler/conn.lua:65: problem adding connection
    
  • mysql://user_name:pass_word@tcp(127.0.0.1:3308)/dbname
    Error  05:23:29 PM notify.error nvim-dbee mysql: invalid url: parse "mysql://user_name:pass_word@tcp(127.0.0.1:3308)/dbname": invalid port ":3308)" after host
    Error  05:23:29 PM notify.error nvim-dbee [handler]: .../share/lazynvim/lazy/nvim-dbee/lua/dbee/handler/conn.lua:65: problem adding connection
    
  • mysql://user_name:pass_word@127.0.0.1/dbname
    Error  05:24:30 PM notify.error nvim-dbee unable to connect to mysql database: default addr for network '127.0.0.1:3308' unknown
    Error  05:24:30 PM notify.error nvim-dbee [handler]: .../share/lazynvim/lazy/nvim-dbee/lua/dbee/handler/conn.lua:65: problem adding connection
    

This is similar to the #14, but the solution posted there no longer works due to URL parsing check added since it was posted: d461eb1

@kndndrj
Copy link
Owner

kndndrj commented Aug 18, 2023

@weirdan Thanks for postinv the issue. I think simplified the url check in mysql driver in a recent PR. Apparently I missed a few cases.
I'll look into this issue as soon as I have some time, meanwhile you can check if an older commit works for you.

@weirdan
Copy link
Author

weirdan commented Aug 26, 2023

For future reference, MySQL DSN, as implemented here, does not include 'protocol' prefix. A working example is user_name:pass_word@tcp(127.0.0.1:3308)/database_name.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants