@simos
I ll try to give you an acurate description of my setup. This post will be a little bit longer, i am sorry for that.
*IPv6 is disabled on the host system by editing the grub file. (ipv6.disable=1)
Container c1-sql
- Image: Ubuntu 18.04 LTS amd64 (8c4e87e53c02)
- apt-get update & upgrade inside the container
- mariadb-server 10.4 installed
IPv4: 10.10.10.10
IPv6: disabled
Container c2-seafile
Image: Ubuntu 18.04 LTS amd64 (8c4e87e53c02)
- apt-get update & upgrade inside the container
- seafile-pro server installed
IPv4: 10.10.10.20
IPv6 disabled
The default profile is attached to both containers and therefor to lxdbr0.
lxdbr0 configuation is as follows:
ipv4.address: 10.10.10.1/24
ipv4.nat: “true”
ipv6.address: none
description: “”
name: lxdbr0
type: bridge
I ve assigned static ip adresses for both containers by using
config device override $container eth0 ipv4.address=10.x.x.x
Scenario 1: (DNS enabled)
Ok, so i created my databases and a mysql user and granted this user all permissions on the seafile databases. In this scenario the sql user was created as username@c2-seafile.lxd.
Reverse DNS in my.cnf was left untouched (enabled by default) I also bound 0.0.0.0 to mysql so that i can connect to the database server from another container.
After i ve set up seafile and running the the seafile start script it will give me the following error message:
Failed to get database connection: Failed to connect to MySQL: Lost connection to MySQL server at ‘handshake: reading inital communication packet’, system error: 110.
If i try again immedaitely after, the script starts without any errors.
I can reproducve this by rebooting the hosts and repeating the steps i just described.
Scenario 2: (DNS disabled)
Same as in scenario 1 only this time i disabled dns lookups in mysql by adding “skip-name-resolve”
in the mysqld section of the my.cnf configuration file.
After that i dropped the database user (user@containername.lxd) from scenario 1 and instead created
username@10.10.10.20, so replacing the host part with an ip adress. After that i reassigned the privileges
for the seafile databases to this new user and made a test again.
Even after several cycles of rebooting and running the script, i wasn`t able to reproduce th error messager anymore.
This may seem like the cause for this problem lies within seafile and thats what i was thinking first but after trying to connect to my sql database remotely with
mysql -h 10.10.10.20 -u seafile -p"whatever" $database
i noticed a few seconds delay until the connection was established when dns resolving is active.
When i did this with “skip-name-resolve” in the config file and systemctl restart mysql, the connection came up almost instantely.
Sure, i got this working after some of trial & error but i am curious if i just made a configuration mistake or missed something and i am sure the dns resolving should work just fine inside lxd containers and that the delay i was experiencing isn`t supposed to be normal.
Thank you for taking the time simon. 
edit:
Of course i understand that this is difficult to reproduce for you, by using seafile as an example but you can easily reproduce this with the mysql command.
(e.g mysql -h 10.10.10.20 -u testuser -p"whatever" testdb)
With the DNS resolver enabled (mariadb default settings) it takes about 5 seconds until i get to the mysql prompt, with “skip-name-resolve” set in the configuration file, there is almost no delay whatsoever.