How do I fix the "Unknown Host" error when connecting to MySQL?

An Unknown Host error like the following occurs when you use the wrong DNS hostname or there are underlying problems with the DNS resolution:

ERROR 2005 (HY000): Unknown MySQL server host 'myqsl--do-user-example-0.db.ondigitalocean.com' (0)

If you are getting this error, first verify that you are using the correct hostname to connect by following How to Connect to MySQL Database Clusters. Then, verify whether the machine you’re connecting from has problems with DNS resolution by following Why does my domain fail to resolve?

Ensure the hostname is correct and confirm the database exists in your specified cluster.
Update backup user permissions, remove the –single-transaction flag, or downgrade mysqldump.
Use MySQL’s import command instead of source for handling large data imports.