Please help me to conect mysql database to docker

You could create both containers on the same overlay network. Then the app container could talk with mysql. See docker connect a service to the overlay network.

Another thing you need to consider is mysql data persistence. When mysql container moves to another node, it should be able to read the existing data. You may refer to the discussions in the question: Data(base) persistence in docker swarm mode.