--- /root/mysql-8.0.28/router/src/router/src/config_generator.cc 2021-12-18 00:07:27.000000000 +0800 +++ config_generator.cc 2022-03-04 11:29:41.386181624 +0800 @@ -360,6 +360,9 @@ URI ConfigGenerator::parse_server_uri(co "non-'localhost' hostname: " + u.host); } + } else { + // setup localhost ip address. + u.host = (u.host == "localhost" ? "127.0.0.1" : u.host); } return u;