在学gorm , 安装了mysql驱动 , 然后就走不下去了
![image.png](https://static.studygolang.com/210911/78a35403328a1aa26023c05f9cc78296.png)
```go
import (
"database/sql"
"time"
_ "github.com/go-sql-driver/mysql"
)
// ...
db, err := sql.Open("mysql", "user:password@/dbname")
if err != nil {
panic(err)
}
// See "Important settings" section.
db.SetConnMaxLifetime(time.Minute * 3)
db.SetMaxOpenConns(10)
db.SetMaxIdleConns(10)
```
建议仔细看文档
#1