Moving Database server to new directory

Can I move the database server to new directory without breaking mattermost? If so what are the steps?

This question is not to mattermost, and the question to your database management system. Usually the database migration described in the description of the normal documentation.
It looks something like this -
Stop services mattermost
manipulate the database
Run mattermost.

If the database you want to move within the server you can simply Relink catalog database to a new location

Can I also move mattermost the new directory or will it break if I move them? My company likes to keep data and applications on a different directory and only OS on the root.