简体   繁体   中英

Mysql Dump Empty File

I tried to follow the many guides online to create a script that makes a backup of SQL database, but unfortunately I find myself with an error in the SQL command because I go to create a file is where I say, and as I say, but it is completely empty ..! The syntax that use is as follows:

exec('mysqldump –opt -user=' . $db_user . ' -password=' . $db_pass . ' --host=' . $db_host . ' ' . $db_nome . ' > ' . $db_filename);

and this:

exec('mysqldump --user=' . $db_user . ' --password=' . $db_pass . ' --host=' . $db_host . ' ' . $db_nome . ' > ' . $db_filename);
echo 'mysqldump –opt -user=' . $db_user . ' -password=' . $db_pass . ' --host=' . $db_host . ' ' . $db_nome . ' > ' . $db_filename;

You see mistakes?

您必须指定mysqldump的完整路径

exec('/usr/bin/mysqldump –opt -user=' . $db_user . ' -password=' . $db_pass . ' --host=' . $db_host . ' ' . $db_nome . ' > ' . $db_filename);

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.

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