Shahidhsalarzai's avatar

how to restore sql database backup from local directories

I generate a backup using spatie and download it after download i code to delete that backup from server so now i have that file i want to upload that file using button in my views having select file so when the file is uploading it should delete all databse and then import from that file

i can do that from myphp admin but client want to restore directly by him self.

0 likes
3 replies
Shahidhsalarzai's avatar

php artisan backup:restore --backup=latest --no-interaction this commond is working in my terminal but dont know how to pass file from html file input

jlrdw's avatar

Did the dump include any stored procedures?

with the --routines switch like?

mysqldump -uroot -pzzzzzz --add-drop-database --databases --routines ledge > "D:\zipfold\mysql_backs\xbacks\ledge.sql"

You should be able to write a PDO query to just execute the statements.

Test something like:

$sql = file_get_contents("your_dump.sql");
$conn->exec($sql);
//  $conn is the connection

But what's wrong with just using the command line?

Shahidhsalarzai's avatar
Shahidhsalarzai
OP
Best Answer
Level 4

actually its not working on windows when i upload on server its working

Please or to participate in this conversation.