A community in which webmasters can ask for help with topics such as PHP coding , MySQL , IT jobs, web design, IT security.
Current location:homephp forumphp talk in 2009 yearEmpty files generated from running `mysqldump` using PHP - page 1
User InfoPosts
Empty files generated from running `mysqldump` using PHP#1
I keep getting empty files generated from running

$command = (mysqldump --opt -h localhost -u username -p \(password\( dbname > \(backup 2009-04-15 09-57-13.sql\((;

command($command);


Anyone know what might be causing this? My password has strange characters in it, but works fine with connecting to the db.

I(ve ran exec($command, $return) and outputted the $return array and it is finding the command. I(ve also ran it with mysqldump > file.sql and the file contains

Usage: mysqldump [OPTIONS] database [tables]
OR mysqldump [OPTIONS] --databases [OPTIONS] DB1 [DB2 DB3...]
OR mysqldump [OPTIONS] --all-databases [OPTIONS]
For more options, use mysqldump --help


So it would seem like the command is working.

posted date: 2009-04-14 16:07:00


Re: Empty files generated from running `mysqldump` using PHP#2
I had made out the solution of this problem. click to view my topic...

hope that hepls.

posted date: 2009-04-14 16:07:01


Re: Empty files generated from running `mysqldump` using PHP#3
Does it happen if you run it from the shell?

posted date: 2009-04-14 16:09:00


Re: Empty files generated from running `mysqldump` using PHP#4
I believe there are no spaces between -u and the actual username.host: localhost user: peter password: pwdwould become:-hlocalhost -upeter -ppwd

posted date: 2009-04-14 16:15:00


Re: Empty files generated from running `mysqldump` using PHP#5
Ah.. I've got the solution now. Thanks anyway Paolo...

posted date: 2009-04-14 16:20:00


Re: Empty files generated from running `mysqldump` using PHP#6
A downvote? hmmm... Can someone point out my error?

posted date: 2009-04-14 16:21:00


Re: Empty files generated from running `mysqldump` using PHP#7
I have no clue why someone would downvote this or vote to close. Maybe an excessively strict opinion that it's "not programming related" since it's about shell-level usage?

posted date: 2009-04-14 16:37:00


Re: Empty files generated from running `mysqldump` using PHP#8
To put it in plain english, make sure to use the following options (all of them).--user=USERNAME--host=localhost--password=****The next non-option phrase should be your database name. If the command is followed by another non-option phrase, it will be treated as table names. $command="mysqldump --xml --host=localhost --user=USERNAME --password=***** DBNAME > XMLTABLE.xml";system($command);

posted date: 2010-01-19 08:38:00


Re: Empty files generated from running `mysqldump` using PHP#9
This is how I have done it - output is with maximum gzip compression:<?php exec("/usr/bin/mysqldump --opt --host=MYSQLHOSTNAME --user=MYSQLUSER --password=PASSWORD DATABASENAME | gzip -v -9 >DATABASENAME.". date("Y-m-d_H-i-s") . ".sql.gz");?>

posted date: 2010-05-23 23:09:00


Re: Empty files generated from running `mysqldump` using PHP#10
$command = (C:\xampp\mysql\bin\mysqldump --opt --user=root --host=localhost --password="password" my_db(.( > (.$backupdate.$sql_file_name; exec($command);I faced the same issue and got it fixed by quoting the password. For example --password="yourpassword".

posted date: 2016-01-10 06:43:00


select page: « 1 »
Copyright ©2008-2017 www.momige.com, all rights reserved.