Question

I begin to creating some php script that make MySQL backup of database using codeigniter framework. But, i have a problem: how to know paths to mysqldump on windows or linux, because I find that mysqldump work on windows only if add full directory address where is this placed for example "D:\xampp\mysql\bin\mysqldump" and in linux is enought "mysqldump" and then add parameters to connect to database. Can you help me?

Was it helpful?

Solution

On Windows, add the path to mysqldump to the executable to your PATH environment variable.

http://www.computerhope.com/issues/ch000549.htm

You can then run mysqldump from any folder. Typically common tools are added the PATH variable by installers, but sometimes if you are installing a tool manually you need to add it yourself.

Your PHP code should not have to search the filesystem to find mysqldump.

OTHER TIPS

In Linux, you can run mysqldump with redirection, so that you can specify where the dump file is created, like so:

mysqldump -password database > /path/to/file
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top