devlake-go fails to connect to devlake database. The problem appears to be related to the value of the default_authentication_plugin MySQL server parameter.
The MySQL server hosting our devlake database runs with the default_authentication_plugin set to mysql_native_password. In this case, devlake-go fails to connect no matter whether the devlake user' password is created with the native or caching_sha2_password plugin.
The connection can be established, however, when I recompile the client with the mysql config parameter AllowNativePasswords set to true.
Expected behavior
❯ DEVLAKE_DBUSER=devlake DEVLAKE_DBPASS=.... make run-api
--> Compiling the project
go build -ldflags "-X main.gitsha=ec5c1ab -X main.compiled=1709134032" -o bin/opendora-api api/main.go
--> Running the OpenDORA API
2024/02/28 16:27:15 connected to DevLake database
Actual Behavior
❯ DEVLAKE_DBUSER=devlake DEVLAKE_DBPASS=... make run-api
--> Compiling the project
go build -ldflags "-X main.gitsha=ec5c1ab -X main.compiled=1709134118" -o bin/opendora-api api/main.go
--> Running the OpenDORA API
[mysql] 2024/02/28 16:28:39 connector.go:95: could not use requested auth plugin 'mysql_native_password': this user requires mysql native password authentication.
2024/02/28 16:28:39 this user requires mysql native password authentication.
exit status 1
make: *** [Makefile:105: run-api] Error 1
Reproduction steps
set up devlake with MySQL 8.* and the server parameter default_authentication_plugin set to mysql_native_password
follow devlake-go README, execute make run-api with your devlake database details
devlake-go fails to connect to the database
The following modification to devlake-go/api/sql_client/client.go fixes the connection issue for this particular case:
Thanks for the thorough explanation of your issue and good catch! For now, I feel like we can implement your modification 1:1. so I will create a PR with the changes :smiley:
Description
devlake-go
fails to connect todevlake
database. The problem appears to be related to the value of thedefault_authentication_plugin
MySQL server parameter.The MySQL server hosting our
devlake
database runs with thedefault_authentication_plugin
set tomysql_native_password
. In this case,devlake-go
fails to connect no matter whether thedevlake
user' password is created with thenative
orcaching_sha2_password
plugin.The connection can be established, however, when I recompile the client with the mysql config parameter
AllowNativePasswords
set totrue
.Expected behavior
Actual Behavior
Reproduction steps
default_authentication_plugin
set tomysql_native_password
devlake-go
README, executemake run-api
with your devlake database detailsdevlake-go
fails to connect to the databaseThe following modification to
devlake-go/api/sql_client/client.go
fixes the connection issue for this particular case:Your Environment
Context of the bug
No response
Have you spent some time to check if this bug has been raised before?
Are you willing to submit PR?
None