I started Ubuntu 18.10 years ago and I encountered problems with a remote database server. I connect via a private network (ip). The query in the mysqlcommand bash takes about 9ms whereas in PHP (for example, PhpMyAdmin) it takes about 1 second. Having no idea what can be turned on. I've also added skip-name-resol.
The private network resolves the second IP in about 50 ms, so I do not see a dot in the long queries.
Note that the local mysql worked perfectly before.