x/website: Tutorial: Accessing a relational database mysql cfg
example does not work
#60319
Labels
Milestone
cfg
example does not work
#60319
What is the URL of the page with the issue?
https://go.dev/doc/tutorial/database-access
What is your user agent?
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/113.0.0.0 Safari/537.36
Screenshot
What did you do?
Follow the instructions on the database-access tutorial. The expected result is not achieved at "Get a database handle and connect" part 3.
What did you expect to see?
Successful
Connected!
messageWhat did you see instead?
Before I changed my password method to native (see https://stackoverflow.com/questions/50093144/mysql-8-0-client-does-not-support-authentication-protocol-requested-by-server):
MySQL server does not support required protocol 41+
After I changed it:
2023/05/20 14:29:31 this user requires mysql native password authentication. exit status 1
I was able to fix this issue by setting
AllowNativePasswords: true
.My theory is that since mysql.Config{} does not set default values, AllowNativePasswords does not get set to its intended default of true (perhaps using NewConfig is a better idea?). A possible change to the tutorial documentation may help newcomers who are attempting this tutorial. I believe a simple additional section to the tutorial for troubleshooting could be added, or perhaps a change to the example code itself? I would be open to implementing this change if possible. Any help is greatly appreciated! Thanks.
The text was updated successfully, but these errors were encountered: