Skip to content

Commit 3f7ef0f

Browse files
authored
Merge branch 'angela/system_variables' into james/server_var_tests
2 parents 0ce9650 + 768a3ee commit 3f7ef0f

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

sql/variables/system_variables.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ package variables
1717
import (
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",

0 commit comments

Comments
 (0)