connect: connection refused #1498

Closed
opened 2019-12-25 10:08:11 +00:00 by qi19901212 · 2 comments
[xorm] [info]  2019/12/25 17:58:42.510601 [SQL] SELECT `TABLE_NAME`, `ENGINE`, `TABLE_ROWS`, `AUTO_INCREMENT`, `TABLE_COMMENT` from `INFORMATION_SCHEMA`.`TABLES` WHERE `TABLE_SCHEMA`=? AND (`ENGINE`='MyISAM' OR `ENGINE` = 'InnoDB' OR `ENGINE` = 'TokuDB') [food]
{"level":"error","ts":"2019-12-25T17:58:42.510+0800",,"message":"dial tcp 127.0.0.1:3306: connect: connection refused",

我现在只要一同步表数据库就断开连接。mysql 已经启动。代码如下

var err error
Engine, err = xorm.NewEngine(tools.DriverName, tools.DataSourceName)
if err!=nil {
    tools.ZapLog.Sugar().Error(err)
    panic(err)
}
Engine.SetMaxOpenConns(tools.MaxOpenConns)
Engine.SetMaxIdleConns(tools.MaxIdleConns)
Engine.SetConnMaxLifetime(time.Second)
Engine.ShowSQL(isDevMode)
err= Engine.Sync2(new(Address),new(Owner),new(Goods))
if err!=nil {
	tools.ZapLog.Sugar().Error(err)
}
``` [xorm] [info] 2019/12/25 17:58:42.510601 [SQL] SELECT `TABLE_NAME`, `ENGINE`, `TABLE_ROWS`, `AUTO_INCREMENT`, `TABLE_COMMENT` from `INFORMATION_SCHEMA`.`TABLES` WHERE `TABLE_SCHEMA`=? AND (`ENGINE`='MyISAM' OR `ENGINE` = 'InnoDB' OR `ENGINE` = 'TokuDB') [food] {"level":"error","ts":"2019-12-25T17:58:42.510+0800",,"message":"dial tcp 127.0.0.1:3306: connect: connection refused", ``` 我现在只要一同步表数据库就断开连接。mysql 已经启动。代码如下 ```go var err error Engine, err = xorm.NewEngine(tools.DriverName, tools.DataSourceName) if err!=nil { tools.ZapLog.Sugar().Error(err) panic(err) } Engine.SetMaxOpenConns(tools.MaxOpenConns) Engine.SetMaxIdleConns(tools.MaxIdleConns) Engine.SetConnMaxLifetime(time.Second) Engine.ShowSQL(isDevMode) err= Engine.Sync2(new(Address),new(Owner),new(Goods)) if err!=nil { tools.ZapLog.Sugar().Error(err) } ```
Owner

time.Second maybe too short?

time.Second maybe too short?
lunny added the
need
feedback
label 2020-01-20 15:45:45 +00:00
Owner

I will close this one since no feedback one month. Please feel free to reopen it.

I will close this one since no feedback one month. Please feel free to reopen it.
lunny closed this issue 2020-02-29 09:17:46 +00:00
Sign in to join this conversation.
No Milestone
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: xorm/xorm#1498
No description provided.