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

Can not connect to mysql inside docker container #461

Closed
Abhinav1217 opened this issue Jan 4, 2019 · 2 comments
Closed

Can not connect to mysql inside docker container #461

Abhinav1217 opened this issue Jan 4, 2019 · 2 comments

Comments

@Abhinav1217
Copy link

Abhinav1217 commented Jan 4, 2019

When I tried to connect to mysql inside a docker container, It gives following error

ER_NOT_SUPPORTED_AUTH_MODE: Client does not support authentication protocol requested by server; consider upgrading MySQL client

I am new to docker and I have followes this medium link to create mysql docker. I have tried testing connection using basic php db test script mysqli_connect using host PHP-FPM to mysql inside docker container, and it does work, But I can not connect to it using sqlectron. What I am missing.

@barneydmedia
Copy link
Contributor

This is actually a bug with this projects mysql driver. We're waiting on the package to be updated and unfortunately can't do much about it until it is, although it is being worked on. See #442 for more info.

@Abhinav1217
Copy link
Author

Abhinav1217 commented Jan 20, 2019

Good to know. Yes I found out that mysql changed how they authenticate the connection. . Apparently this caused an issue discussion everywhere from Laravel to PDO to even JDBC.

Simple solution is to not upgrade the mysql. Other solution is to execute following command in the mysql shell.

alter user 'username'@'localhost' identified with mysql_native_password by 'password';

This will tell mysql server to use legacy authentication method.
I used the latter and was able to connect using sqlectron, along with other drivers within the app.

Regarding docker here is a solution for using latest mysql version.

 command: ['--character-set-server=utf8mb4', '--collation-server=utf8mb4_unicode_ci','--default-authentication-plugin=mysql_native_password']

Note: Solutions mentioned above will actually tell mysql server to use older authentication method. Which as discussed on their blog, is outdated, insecure and slow. Real solution would be to update drivers which use latest sha2 password plugin to connect to the server.

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

No branches or pull requests

2 participants