I have run mysqldump on a test database using the bash command line and it works fine:
C:\\wamp\\bin\\mysql\\mysql5.6.12\\bin\\mysqldump --opt -u root -p membersite > c:\\wamp\\www\\php-backup\\membersitebackupfile1.sql
When I put the same line in a PHP file located in "c:\\wamp\\www\\php-backup\\dump.php" it produces a file with 0 bytes.
<?php
$command = "C:\\wamp\\bin\\mysql\\mysql5.6.12\\bin\\mysqldump --opt -u root -p membersite > c:\\wamp\\www\\php-backup\\membersitebackupfile1.sql";
exec($command);
?>
If you are using wamp then try:
$cmd = 'c: & cd "C:/wamp/bin/mysql/mysql5.6.17/bin" & mysqldump.exe --user=root --password=root --host=localhost databasename> "C:\Directory\SQL.sql"';
exec($cmd);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.