当前位置:Gxlcms > 数据库问题 > go mysql dsn

go mysql dsn

时间:2021-07-01 10:21:17 帮助过:2人阅读

https://github.com/go-sql-driver/mysql#dsn-data-source-name

 

DSN (Data Source Name)

The Data Source Name has a common format, like e.g. PEAR DB uses it, but without type-prefix (optional parts marked by squared brackets):

[username[:password]@][protocol[(address)]]/dbname[?param1=value1&...&paramN=valueN]

A DSN in its fullest form:

username:password@protocol(address)/dbname?param=value

Except for the databasename, all values are optional. So the minimal DSN is:

/dbname

If you do not want to preselect a database, leave dbname empty:

/

This has the same effect as an empty DSN string:


Alternatively, Config.FormatDSN can be used to create a DSN string by filling a struct.

go mysql dsn

标签:

人气教程排行