赞
踩
- package main
- import (
- "fmt"
- "github.com/jinzhu/gorm"
- _ "github.com/jinzhu/gorm/dialects/mysql"
- )
- func main() {
- db, err := gorm.Open("mysql", "root:password@tcp(129.226.160.114:3306)/basic?charset=utf8")
- if err != nil {
- fmt.Println("数据库连接错误")
- }
- fmt.Println(err)
- defer db.Close()
- }
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。