mySQL / MariaDB - Resolve "Aborted connection to db unconnected"

by
Jeremy Canfield |
Updated: July 19 2021
| mySQL / MariaDB articles
Let's say your mySQL or MariaDB error log contains the following warning.
Aborted connection 209541 to db: 'unconnected' user: 'john.doe' host: 'server1.example.com' (Got an error reading communication packets)
Notice in this example that the connection was aborted for user john.doe. If you have root access to mySQL or MariaDB, check John Doe's grants. Notice in this example that % is used. Since the error references a hostname (server1.example.com), the % character is used because % represents remote connection (not localhost).
~]# mysql -e "show grants for 'john.doe'@'%'"
+----------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Grants for john.doe@% |
+----------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| GRANT USAGE ON *.* TO `john.doe`@`%` IDENTIFIED BY PASSWORD '*B87A204DF7CFB2D10258BBA8AC00DC081CD35EF2' |
+----------------------------------------------------------------------------------------------------------------------------------------------------------------------+
Let's say you determine that John Doe needs to be granted access to replication slave. You can use the grant statement to grant John Doe access.
mysql -e "grant replication slave on *.* to 'john.doe'@'%'"
Reissuing the show grants statement, you should now see John Does updated grants.
~]# mysql -e "show grants for 'john.doe'@'%'"
+----------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Grants for john.doe@% |
+----------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| GRANT REPLICATION SLAVE, REPLICATION MASTER ADMIN, SLAVE MONITOR ON *.* TO `john.doe`@`%` IDENTIFIED BY PASSWORD '*B87A204DF7CFB2D10258BBA8AC00DC081CD35EF2' |
+----------------------------------------------------------------------------------------------------------------------------------------------------------------------+
Did you find this article helpful?
If so, consider buying me a coffee over at