diff --git a/conf/app.ini b/conf/app.ini index 05c7745fc4..abc27c39c4 100644 --- a/conf/app.ini +++ b/conf/app.ini @@ -20,7 +20,7 @@ HTTP_PORT = 3000 [database] ; Either "mysql", "postgres" or "sqlite3"(binary release only), it's your choice DB_TYPE = mysql -HOST = +HOST = 127.0.0.1:3306 NAME = gogs USER = root PASSWD = diff --git a/models/models.go b/models/models.go index 04a361c595..bafa1747e8 100644 --- a/models/models.go +++ b/models/models.go @@ -38,7 +38,7 @@ func SetEngine() { var err error switch DbCfg.Type { case "mysql": - orm, err = xorm.NewEngine("mysql", fmt.Sprintf("%s:%s@%s/%s?charset=utf8", + orm, err = xorm.NewEngine("mysql", fmt.Sprintf("%s:%s@tcp(%s)/%s?charset=utf8", DbCfg.User, DbCfg.Pwd, DbCfg.Host, DbCfg.Name)) case "postgres": orm, err = xorm.NewEngine("postgres", fmt.Sprintf("user=%s password=%s dbname=%s sslmode=%s",