Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

@@hostname always shows localhost #32918

Closed
djshow832 opened this issue Mar 8, 2022 · 0 comments · Fixed by #33064
Closed

@@hostname always shows localhost #32918

djshow832 opened this issue Mar 8, 2022 · 0 comments · Fixed by #33064
Assignees
Labels
affects-5.1 This bug affects 5.1.x versions. affects-5.2 This bug affects 5.2.x versions. affects-5.3 This bug affects 5.3.x versions. affects-5.4 This bug affects 5.4.x versions. severity/moderate sig/sql-infra SIG: SQL Infra type/bug The issue is confirmed as a bug.

Comments

@djshow832
Copy link
Contributor

djshow832 commented Mar 8, 2022

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

mysql> select @@hostname;
+------------+
| @@hostname |
+------------+
| localhost  |
+------------+
1 row in set (0.00 sec)

2. What did you expect to see? (Required)

mysql> select @@hostname;
+---------------+
| @@hostname    |
+---------------+
| 192.168.0.101 |
+---------------+
1 row in set (0.00 sec)

3. What did you see instead (Required)

mysql> select @@hostname;
+------------+
| @@hostname |
+------------+
| localhost  |
+------------+
1 row in set (0.00 sec)

4. What is your TiDB version? (Required)

master

The reason: in #24412, there is a little mistake:

if hostname, err := os.Hostname(); err != nil {        // should be `err == nil`
	variable.SetSysVar(variable.Hostname, hostname)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
affects-5.1 This bug affects 5.1.x versions. affects-5.2 This bug affects 5.2.x versions. affects-5.3 This bug affects 5.3.x versions. affects-5.4 This bug affects 5.4.x versions. severity/moderate sig/sql-infra SIG: SQL Infra type/bug The issue is confirmed as a bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant