How to "properly" back up a MySQL/MariaDB database?
You should use mysqldump, for example if you want to backup all databases:

# mysqldump --all-databases &gt; dump.sql


You might need to add options for username, password, etc. Read the online documentation on mysqldump (MySQL Reference Manual) for other options.

If you just copy the database files while the server is running, it is very likely that you will be unable to restore databases using those files.