简体   繁体   English

MySQL中的MySQLdump,我需要将它转储到特定的目录中

[英]MySQLdump in php, I need it to dump in a specific directory

I run a script in one of my php files that dumps a specific database which works fine, but it puts the created file in the directory where the scripts is called. 我在我的一个php文件中运行一个脚本来转储一个工作正常的特定数据库,但它将创建的文件放在调用脚本的目录中。 How can I make it to store the file in a specific directory? 如何将文件存储在特定目录中? (eg /blahblah/backups) (例如/ blahblah / backups)

Here's the code (the connection code is not included but you get the idea) 这是代码(连接代码不包括但你明白了)

system("mysqldump -h $pdb_server -u $pdb_user -p$pdb_pwd $pdb_name > $backupfile");

could I just add 我可以添加吗?

/path/to/output/$backupfile

Put the Path before the command: 在命令之前放置Path:

system("cd /path/to/output/$backupfile; mysqldump -h $pdb_server -u $pdb_user -p$pdb_pwd $pdb_name > $backupfile");

or 要么

system("mysqldump -h $pdb_server -u $pdb_user -p$pdb_pwd $pdb_name > /path/to/output/$backupfile");

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM