You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am following this Tutorial: Accessing a rational database
In the first place when we try to run the main.go to file with the below code
var db *sql.DB
func main() {
// Capture connection properties.
cfg := mysql.Config{
User: os.Getenv("DBUSER"),
Passwd: os.Getenv("DBPASS"),
Net: "tcp",
Addr: "127.0.0.1:3306",
DBName: "recordings",
}
// Get a database handle.
var err error
db, err = sql.Open("mysql", cfg.FormatDSN())
if err != nil {
log.Fatal(err)
}
pingErr := db.Ping()
if pingErr != nil {
log.Fatal(pingErr)
}
fmt.Println("Connected!")
}
many folks getting error when main.go file execute. the error getting is : This user requires MySQL native password authentication.
What did you expect to see?
I expect to see the MySQL database is connected with the Go code.
What did you see instead?
Instead of a connected database, I am getting this user requires MySQL native password authentication. this error and database connection is refused when we run main.go file.
The text was updated successfully, but these errors were encountered:
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 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/112.0.0.0 Safari/537.36
Screenshot
What did you do?
I am following this Tutorial: Accessing a rational database
In the first place when we try to run the main.go to file with the below code
many folks getting error when main.go file execute. the error getting is :
This user requires MySQL native password authentication.
What did you expect to see?
I expect to see the MySQL database is connected with the Go code.
What did you see instead?
Instead of a connected database, I am getting
this user requires MySQL native password authentication.
this error and database connection is refused when we run main.go file.The text was updated successfully, but these errors were encountered: