Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我在我的一个 php 文件中运行一个脚本,该脚本转储一个运行良好的特定数据库,但它将创建的文件放在调用脚本的目录中。如何使其将文件存储在特定目录中?(例如 /blahblah/backups)
这是代码(不包括连接代码,但你明白了)
system("mysqldump -h $pdb_server -u $pdb_user -p$pdb_pwd $pdb_name > $backupfile");
我可以补充一下吗
/path/to/output/$backupfile
将路径放在命令之前:
system("cd /path/to/output/$backupfile; mysqldump -h $pdb_server -u $pdb_user -p$pdb_pwd $pdb_name > $backupfile");
或者
system("mysqldump -h $pdb_server -u $pdb_user -p$pdb_pwd $pdb_name > /path/to/output/$backupfile");