Home >Database >Mysql Tutorial >How Can I Generate a MySQL Dump from a PHP File on Linux?
For those working with MySQL on a Linux system and seeking to create a mysqldump from within a PHP file, the exec() function offers a solution. By utilizing this function, you can execute commands from the command line.
Here's how you can achieve this:
exec('mysqldump --user=$user --password=$password --host=$host --database=$dbName > $dumpFilepath');
Replace the variables with appropriate values.
exec('mysqldump --user=$user --password=$password --host=$host --database=$dbName ');
Additional Notes:
The above is the detailed content of How Can I Generate a MySQL Dump from a PHP File on Linux?. For more information, please follow other related articles on the PHP Chinese website!