Programster's Blog

Tutorials focusing on Linux, programming, and open-source

MySQL 8 - Slow Connecting Problem

If you just installed MySQL 8 (the default on Ubuntu 20.04), and you notice that your code seems to be running slower than you expect, it may be that there is a delay every time your code is connecting to the MySQL server. This could be a DNS problem. This tutorial will show you how you can disable DNS host name lookups which will "fix" this (alternatively you could resolve the underlying DNS issue).

Steps

Update the configuration file:

sudo editor /etc/mysql/mysql.conf.d/mysqld.cnf

Add this line to it:

skip-name-resolve

References

Last updated: 13th November 2020
First published: 13th November 2020