Open gunsluo opened 8 years ago
godrv.Register("SET NAMES utf8")
// Create a connection handler db, err := sql.Open("mymysql", "test/testuser/TestPasswd9") checkErr(err)
failed..
godrv registers "SET NAMES utf8" by default (see Example 7). What do you mean by very descriptive "failed"?
db, err := sql.Open("mymysql", conn)
sql := select * from test;
rows, err := db.Query(sql)
there is no garbled.
but use:db := mysql.New("tcp", "", url, user, pwd, dbname) ,there is garbled
Try:
db.Query("SET NAMES utf8")
connection string -> tcp:127.0.0.1:3306*nt_financial/root/jxcec0okm ?
tcp:127.0.0.1:3306*nt_financial/root/jxcec0okm?charset=utf8