Beego ORM MySQL: default addr for network '…' unknown


My database link is a domain name instead of an IP address, and I don’t use the ip address. Below is my configuration.

orm.RegisterDataBase("default", "mysql", "root:root@*******")

Error Messageļ¼š

register db Ping default, default addr for network ‘***’ unknown
must have one register DataBase alias named default


I checked on the go-mysql-driver source code, on file dsn.go:116, the error only occurs when the network type is "".

You might need to specify the selected network type on the connection string (whether it is tcp or unix). Use the below connection string scheme instead of the one you are using.


With your code, it would be like this:

connectionString := "root:root@tcp(*******"
orm.RegisterDataBase("default", "mysql", connectionString)

Note: network type tcp is chosen in the example above.

Answered By – novalagung

Answer Checked By – Jay B. (GoLangFix Admin)

Leave a Reply

Your email address will not be published.