I had these errors randomly popup too I'm not sure if you have the same issue but your description sounds similar.
My issue was related to my MySQL server having multiple network interfaces with one configured public and one private and these connection errors were a result of how I set up the mysql user. I had it set up as kamailio@'private.ip' but kamailio was actually attempting connection to the public IP (which was not authorized). If you have multiple network interfaces I would suggest checking kamailio.cfg and the user set up to access mysql and verify your IP's/hostnames and maybe even verify on both boxes what interfaces the connections our going out/coming in on.