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: 25th January 2021
First published: 13th November 2020

This blog is created by Stuart Page

I'm a freelance web developer and technology consultant based in Surrey, UK, with over 10 years experience in web development, DevOps, Linux Administration, and IT solutions.

Need support with your infrastructure or web services?

Get in touch