Golang, mysql: Error 1040: Too many connections

前端 未结 5 1672
终归单人心
终归单人心 2021-02-01 17:57

I\'m using the github.com/go-sql-driver/mysql driver for go.

I open a database:

db, err := sql.Open(\"mysql\", str)

Then I have two fun

5条回答
  •  太阳男子
    2021-02-01 18:15

    hi can you try close connection after used

    db, err := sql.Open("mysql", str)
    defer db.Close() // close after end scope
    

提交回复
热议问题