Is it safe and reliable to backup MySQL databases by backing up the data folder?

I have a MySQL database [server version 5.0.x, type InnoDB] which I want to backup. I don’t have username/password to back it up using mysqldump. My question, is it safe to back up the database by backing up the entire MySQL’s data folder (of course, after stopping the MySQL server service in Windows 7)?

Can’t You get username/password from Repo config?

It would be better to use mysqldump. The dump acts as a log that allows You to rebuild from fresh install.

1 Like

I doubt you can get a non corrupt backup that way in a production environment, as people can still issue queries while your backup is running. So some files might represent a different db state than others.

1 Like

that’s not possible, as he said, that he would stop the DB server before.

1 Like

It is possible to move the files if they are not in use. I have done it on Linux (I cannot tell for Windows)… but I would never advise You to do so. I am not sure it would even work if using different postgresql versions.

If You can access db, then You have already some sort of authorization.

1 Like

Seems that it is possible and safe as described at this tutorial on https://linode.com/docs/databases/mysql/back-up-your-mysql-databases/:

While the mysqldump tool is the preferred backup method, there are a couple of cases that require a different approach. mysqldump only works when the database server is accessible and running. If the database cannot be started or the host system is inaccessible, we can copy MySQL’s database directly. This method is often necessary in situations where you only have access to a recovery environment like Finnix with your system’s disks mounted in that file system. If you’re attempting this method on your system itself, ensure that the database is not running.