Skip to content

Add a param 'unescapeUser' to format dns like 'testdb%25dbuser:password@...' #460

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

Closed
wants to merge 3 commits into from

Conversation

qindj
Copy link

@qindj qindj commented Jun 2, 2016

Description

First ,the format : "testdb%dbuser:password.." is used in MySQL on Azure...

Recently I used some other projects such as Telegraf(https://github.com/influxdata/telegraf) which using this library to connect to MySQL.

These projects check dsn using url.Parse(), if I use "testdb%dbuser:password.." , error is "invalid URL escape %db". I tried to use a escaped value like "testdb%25dbuser:password...", error is "2001 user is not found from the service " because the username is wrong (with %25 not %)

So I make some changes to make it working.

I don't know this matter belongs to this library or the projects which using this library.

Correct me if I have any mistake.

Thanks!

Checklist

  • Code compiles correctly
  • Created tests which fail without the change (if possible)
  • All tests passing
  • Extended the README / documentation, if necessary
  • Added myself / the copyright holder to the AUTHORS file

@julienschmidt
Copy link
Member

There are several other things that can go horrible wrong when trying to parse a DSN with url.Parse.
Our DSNs are unfortunately not valid URLs, no will they ever be without a breaking change.

@julienschmidt
Copy link
Member

FYI: https://godoc.org/github.com/go-sql-driver/mysql#ParseDSN can be used to validate a DSN

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

Successfully merging this pull request may close these issues.

2 participants