Description:
When we connect with user root@127.0.0.1 current_status()/status does not reflect expected value but root@localhost.
When root@localhost is dropped then it does show the expected value. This looks a bit strange.
skip-name-resolve solves the problem. But IMHO it should work anyway...
Possibly this is not considered to be a bug but it looks at least strange to me.
How to repeat:
mysql> select user, host from mysql.user where user = 'root';
+------+-----------+
| user | host |
+------+-----------+
| root | 127.0.0.1 |
| root | localhost |
+------+-----------+
mysql> show grants for root@localhost;
+---------------------------------------------------------------------+
| Grants for root@localhost |
+---------------------------------------------------------------------+
| GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' WITH GRANT OPTION |
+---------------------------------------------------------------------+
mysql> show grants for root@'127.0.0.1';
+---------------------------------------------------------------------+
| Grants for root@127.0.0.1 |
+---------------------------------------------------------------------+
| GRANT ALL PRIVILEGES ON *.* TO 'root'@'127.0.0.1' WITH GRANT OPTION |
+---------------------------------------------------------------------+
shell> mysql --user=root --host=localhost
mysql> status;
Current user: root@localhost
Connection: Localhost via UNIX socket
mysql> select current_user();
+----------------+
| current_user() |
+----------------+
| root@localhost |
+----------------+
shell> mysql --user=root --host=127.0.0.1
Current user: root@localhost
Connection: 127.0.0.1 via TCP/IP
mysql> select current_user();
+----------------+
| current_user() |
+----------------+
| root@localhost |
+----------------+
mysql> drop user root@localhost;
mysql> select current_user();
+----------------+
| current_user() |
+----------------+
| root@localhost |
+----------------+
shell> mysql --user=root --host=127.0.0.1
mysql> select current_user();
+----------------+
| current_user() |
+----------------+
| root@127.0.0.1 |
+----------------+
Suggested fix:
last value should already be shown in the beginning.
Page generated in 0.042 sec. using MySQL 8.4.7-u6-cloud
Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the
respective copyright holders. It is not reviewed in advance
by Oracle and does not necessarily represent the opinion of
Oracle or any other party.