-
Notifications
You must be signed in to change notification settings - Fork 158
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
Cannot open MySQL database #12
Comments
With workaround for librespeed/speedtest-go#12
I'm not really sure about this issue, is this Docker specific? |
I'm getting this issue as well Environment: ive tried using the hostname as well as the ip address (with and without mysql port included) . and both result in the following error: database_hostname="my-dns-host" All of the above produce the same connection error on startup. It seems like its failing to resolve dns. However, the os itself is able to do it just fine... I've also tried adding a host file entry for ip dns record in /etc/hosts. However, it still produces the same error. |
in https://github.com/go-sql-driver/mysql#examples
so database_hostname should be set in this format :
|
FYI, I found that by writing the configuration file as shown below, everything works without any problems. database_type="mysql"
database_hostname="tcp(127.0.0.1:3306)"
database_name="speedtest"
database_username="speedtest"
database_password="EXAMPLEPASSWORD" We may need to add this "MySQL-specific configuration" to the README, or rewrite the code for connecting to MySQL as follows. (Of course, this is a dirty example.) speedtest-go/database/mysql/mysql.go Line 14 in 158e37d
// connectionStringTemplate = `%s:%s@%s/%s?parseTime=true`
connectionStringTemplate = `%s:%s@tcp(%s:3306)/%s?parseTime=true` |
Log:
Environment
Links
The text was updated successfully, but these errors were encountered: