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?

有帮助吗?

解决方案

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.

其他提示

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
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top