File tree Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -17,6 +17,7 @@ package variables
1717import (
1818 "fmt"
1919 "math"
20+ "os"
2021 "strings"
2122 "sync"
2223 "time"
@@ -187,6 +188,11 @@ func init() {
187188 InitSystemVariables ()
188189}
189190
191+ func getHostname () string {
192+ hostname , _ := os .Hostname ()
193+ return hostname
194+ }
195+
190196// systemVars is the internal collection of all MySQL system variables according to the following pages:
191197// https://dev.mysql.com/doc/refman/8.0/en/server-system-variables.html
192198// https://dev.mysql.com/doc/refman/8.0/en/replication-options-gtids.html
@@ -1009,7 +1015,7 @@ var systemVars = map[string]sql.SystemVariable{
10091015 Dynamic : false ,
10101016 SetVarHintApplies : false ,
10111017 Type : types .NewSystemStringType ("hostname" ),
1012- Default : "" ,
1018+ Default : getHostname () ,
10131019 },
10141020 "immediate_server_version" : & sql.MysqlSystemVariable {
10151021 Name : "immediate_server_version" ,
You can’t perform that action at this time.
0 commit comments