-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Doesn't use database from DSN if tls=true #884
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
Comments
This sounds similar to issue #825 but the commit in which this is fixed produces the same problem in my scenario. |
Note that I can also reproduce this in v1.4.0 (d523deb). |
You didn't check error returned by It says: You need to specify |
The error check from I can verify in my case that the certificate is valid and signed by a trusted CA, and I don't receive the x509 validation error in @methane 's case. Also, this can't be the case from my example since the connection is being made and I can successfully query and show output for |
Also, just as a check, using |
I can't reproduce. I can get right database name. |
The default auth plugin is set to |
It's very important information! |
If I change the default auth plugin for the server to With the server's default set to Before I ask our db security team whether we can permanently change the default plugin auth to native, is there something in the go-sql-driver/mysql package that can be fixed to address this? |
Yes. But it may take very long time to fix. |
Not sure if related to this, but since d523deb and head something broke TLS authentication. I use client certs, and using the latest commit of this driver causes:
Any clues? This is blocking to upgrade to latest github.com/go-sql-driver/mysql. |
Didn't work. I downloaded from https://patch-diff.githubusercontent.com/raw/go-sql-driver/mysql/pull/887.patch and applied with patch -p1 on HEAD. It applied cleanly, I rebuilt my thing and got the same error. |
@fiorix I used several hours to test client cert (I had not used it yet. So I need to use several hours to set up) Then, I can connect to MySQL with/without password. Could you provide reproducible example demonstrates your issue? This is issue tracker, not user forum. We're maintainer, not free tech support. |
I cannot provide any easy way to repro this as of now. Our use case is a bit more complex. |
Regardless how your application is complicated, authentication error must be simple. It is not relating to your app. Without information to reproduce, "it doesn't work for me" is just a spam to maintainer. |
Hey sorry, spamming wasn't my intention. Let me give you a bit more context about why I think there's an issue with recent changes: Our internal codebase is pinned to d523deb. We have our own "fbmysql" driver which figures out which instances to connect to (master or slaves), it then hits our CA server to issue a x509 cert for the specific client and server, then it configures go-sql-driver/mysql to use those TLS settings, and generate the DSN to connect. When we upgrade past d523deb, we get that Access Denied for any connection. I haven't had the time yet to nail it down to which change actually introduced the problem, and like I said it's not easy to provide an easy standalone version of the code to reproduce. |
This special flow is totally not ralating to this driver.
You know:
We don't know nothing about these. If it's "not easy" to you, it's "impossible" to us. |
Maybe I wasn't clear enough. I wanted to clarify why I didn't provide more information, wasn't asking for anything. We have yet to figure out what's up with recent changes in this repo. |
Read the ISSUE_TEMPLATE.md!!! |
Issue description
Using
tls=true
in the DSN causes the db name in the DSN to be ignored when queries are executed.Example code
Edit: I modified the example to verify that no error occurs, and fixed to use
NullString
to handle null return value.I've added an all-access test user to my MySQL server using:
With TLS turned off, this produces, as expected:
With TLS turned on, this produces, which is unexpected:
In the latter case, I'd expect
DATABASE() = mydb
. I can manually run aUSE test;
statement from my sample program, but it defeats the purpose of specifying the db name in the DSN, and in a real app, I'd have to run that prior to every statement to ensure newly created connections also use this db name.Error log
No errors logged, that I could see.
Configuration
Driver version (or git SHA):
7daee5b
Go version:
go version go1.11.1 linux/amd64
Server version:
5.7.21-21-log MySQL Community Server (GPL)
Server OS:
Red Hat Enterprise Linux Server release 6.8 (Santiago)
The text was updated successfully, but these errors were encountered: