-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Unable to connect to MySQL 8 #785
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
I've been looking into it. It looks like to make it work you need to set legacy Authentication in MySQL 8 (which is less secure of course). Installation scripts for Ubuntu 16.04 ship this file (if you select Legacy MySQL 8 authentication) [mysqld] Note: It looks like currently it is NOT enough to simply create user using native_password authentication - it will still fail with different error message Cannot connect to MySQL: this user requires mysql native password authentication. It has been suggested in other issue #625 to do this to make native password accounts to work: Note that you will need to explicitly set "allowNativePasswords=True" in the DSN. |
Hi |
@rykr @PeterZaitsev I am at PerconaLive conf this week, if you down here, we could work on this together. Lemme know |
I was bitten by a similar issue while working on dbdeployer. The workaround is to change authentication plugin for the user. However, the root user is created during a previous run of the server, where the default plugin was After changing the authentication plugin in the user, you need to set the password again. With
Your sample program will run successfully after the change. The suggestion from @PeterZaitsev works for all users created after restarting the server with the new directive. |
@arthurnn I wish I was there. I'm back at the office but would love to compare notes with you on this as I try to get up a pull request to fix this. |
Here is a link to an article that may help for anyone trying to implement a real fix for this issue: |
I have verified @datacharmer's suggested workaround - the change is on a per-user basis. So if you want to maintain the overall config, disabling for one user appears to be an acceptable condition. Thanks! |
#794, adding support for MySQL 8.0's default auth plugin was merged. Some feedback whether further problems occur would be great! |
I had to do add the following to my stack.yml when using a mysql docker container then it worked. Posting here in hopes that it helps someone else: |
import mysql.connector def connect(): if name == 'main': Output : Connected to MySQL database Follow the Screenshot 👍
|
Issue description
MySQL 8 has now gone into general availability and I am seemingly unable to connect to a MySQL 8 instance as I have previously done with 5.x.
Lets say for example I have a MySQL instance running locally via Docker like so:
Then I can try to connect to this instance:
Example code
Of course I would expect this to work and I'd see the
all good
message (which is the case with a 5.7 instance for example). However I see the following:Error log
Configuration
Driver version (or git SHA):
3287d94
Go version: run
go version
in your consolego version go1.10 darwin/amd64
Server version: E.g. MySQL 5.6, MariaDB 10.0.20
8.0.11
Server OS: E.g. Debian 8.1 (Jessie), Windows 10
Mac OS 10.12.6
The text was updated successfully, but these errors were encountered: