Skip to content

x/website: Tutorial: Accessing a relational database mysql cfg example does not work #60319

Closed as not planned
@vansharora03

Description

@vansharora03

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

image

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! message

What 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.
image

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions