Go sql.open connection address placeholder

I read the mysql information from the configuration file. How do mysql hosts, users, passwords, and database names be passed to sql.open () as variables?

cfg, err := ini.Load("setting.ini")
//cfg.BlockMode = false
if err != nil {
    panic(err)
}
mysqlhost := cfg.Section("mysql").Key("host").String()
mysqluser := cfg.Section("mysql").Key("user").String()
mysqlpassword := cfg.Section("mysql").Key("password").String()
mysqldatabase := cfg.Section("mysql").Key("database").String()
dbconn, err = sql.Open("mysql", "%s:%s@tcp(%s)/%s?charset=utf8&parseTime=True&loc=Local")
Jan.08,2022

concatenate DSN of mysql connections with strings from the standard library

conn = fmt.Sprintf("%s:%s@tcp(%s)/%s?charset=utf8&parseTime=True&loc=Local", 
    mysqluser, 
    mysqlpassword,
    mysqlhost,
    mysqldatabase,
)
dbconn, err = sql.Open("mysql", conn)
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b3bf63-2c2d0.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b3bf63-2c2d0.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?