Skip to main content

Driver Addition and Import

  • Initialize MySQL driver import in main.go:
import (
_ "github.com/gogf/gf/contrib/drivers/mysql/v2"
)
  • Add the driver library and version in go.mod:
require (
github.com/gogf/gf/contrib/drivers/mysql/v2 v2.5.3
github.com/gogf/gf/v2 v2.5.3
)
  • Update dependencies in the command line:
go mod tidy

After completing these steps, the setup for using the database in GoFrame is complete. You can now proceed with database operations.