GORM Playground Link

https://github.com/go-gorm/playground/pull/1

Description

I am trying to connect to a an 8.03 MySQL database via an SSH port. I followed the docs for connecting to a database and get the following error:

Error occurred while connecting with the database : error=Error 1064: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '"' at line 1

My code:

dbUser := os.Getenv("dbUser") // DB username
dbPass := os.Getenv("dbPass") // DB Password
dbHost := os.Getenv("dbHost") // DB Hostname/IP
dbName := os.Getenv("dbName") // Database name

dsn := fmt.Sprintf("%s:%s@tcp(%s)/%s?charset=utf8mb4\"", dbUser, dbPass, dbHost, dbName)

db, err := gorm.Open(mysql.Open(dsn), &gorm.Config{})

if err != nil {
    fmt.Printf("Error occurred while connecting with the database : error=%v\n", err)
    return

I have been able to connect to the same database using the normal MySQL driver, however with one modification where I allow native password (I'm not sure if the has anything to do with this):

cfg := mysql.Config{ User: dbUser, Passwd: dbPass, Net: "tcp", Addr: dbHost, DBName: dbName, AllowNativePasswords: true, }

Comment From: github-actions[bot]

The issue has been automatically marked as stale as it missing playground pull request link, which is important to help others understand your issue effectively and make sure the issue hasn't been fixed on latest master, checkout https://github.com/go-gorm/playground for details. it will be closed in 30 days if no further activity occurs. if you are asking question, please use the Question template, most likely your question already answered https://github.com/go-gorm/gorm/issues or described in the document https://gorm.io ✨ Search Before Asking

Comment From: github-actions[bot]

The issue has been automatically marked as stale as it missing playground pull request link, which is important to help others understand your issue effectively and make sure the issue hasn't been fixed on latest master, checkout https://github.com/go-gorm/playground for details. it will be closed in 30 days if no further activity occurs. if you are asking question, please use the Question template, most likely your question already answered https://github.com/go-gorm/gorm/issues or described in the document https://gorm.io ✨ Search Before Asking

Comment From: github-actions[bot]

The issue has been automatically marked as stale as it missing playground pull request link, which is important to help others understand your issue effectively and make sure the issue hasn't been fixed on latest master, checkout https://github.com/go-gorm/playground for details. it will be closed in 30 days if no further activity occurs. if you are asking question, please use the Question template, most likely your question already answered https://github.com/go-gorm/gorm/issues or described in the document https://gorm.io ✨ Search Before Asking