Docker mysql on host machine or on container

Hello All,

I am new in devops, and trying to learn how docker helps to simply deployment process. I am learning how to deploy front end backend and database app using dockerfile and docker-compose.
I have created two separate files, one for front end app and 2nd for service end(backend). I am confused about database. Should I use docker container for mysql db or install mysql on host machine and use that to connect to project. That way I think it would be secure and data will not be deleted everytime we deploy project. Any help is much appreciated.

Thanks, prasad