Scale up as you grow — whether you're running one virtual machine or ten thousand.

From GPU-powered inference and Kubernetes to managed databases and storage, get everything you need to build, scale, and deploy intelligent applications.

Hi DigitalOcean Community,
I’m currently working on a Laravel application deployed on DigitalOcean’s App Platform. I need to implement a feature to export the database from my Laravel application and store the SQL dump file on DigitalOcean Spaces.
I’ve tried using the mysqldump command in my application code, but I’m encountering issues because it’s not available in the App Platform environment. Can someone please guide me on how to export the database in Laravel on DigitalOcean App Platform without relying on mysqldump?
Here’s what I’ve tried so far:
public function exportDatabase()
{
// Set the filename for the exported SQL file
$fileName = 'database_backup_' . date('YmdHis') . '.sql';
$filePath = 'database/' . $fileName;
// Execute mysqldump command to export the database
$dumpContent = $this->executeMysqldump();
// Save the output to a file
Storage::put($filePath, $dumpContent);
// Upload the SQL dump file to DigitalOcean Spaces
Storage::disk('digitalocean')->put('uploads/backup/' . $fileName, $dumpContent);
// Return the URL of the uploaded file
return Storage::url($filePath);
}
private function executeMysqldump()
{
// Execute mysqldump command to export the database
$process = new Process([
'mysqldump',
'-u' . env('DB_USERNAME'),
'-p' . env('DB_PASSWORD'),
env('DB_DATABASE'),
]);
$process->run();
// Check for errors during command execution
if (!$process->isSuccessful()) {
throw new ProcessFailedException($process);
}
return $process->getOutput();
}
a6309a057c3f4cb38fb2e7feb67236
KFSys
ef1ed44cc2154be3bcbb2d727878f8
Devs Neonetworks
1e6b823ea20d4cb189a34a922f5588
Telmo Valverde
erik-jan martens
Henry Mui
anthonycarreon
garantieheld
Marin