Create and Schedule Automatic MySQL Database Backups In PHP
Vložit
- čas přidán 24. 07. 2024
- In this video, I'll show you how to create a PHP script that will backup your MySQL databases. Then I'll show you how to run the script automatically when Windows 10 starts by creating a task in Task Scheduler.
Intro 🕔 0:00
Writing The Script 🕔 0:48
Testing The Script 🕔 9:25
Creating A Task In Task Scheduler 🕔 10:27
Testing The Task 🕔 14:13 - Věda a technologie
Thank you for making this tutorial, this helps me make a quick backup on my database :) and i love the task scheduler instruuction, i learned new things :), love and respect from a fellow programmer
Thanks a lot for this video. I was easy to follow and your work to make it look very straight forward. It helped me a lot.
No problem. 😀
Nice
Thanks a lot for sharing. Was success but why my stored procedure is not in the backup file, have tried to restore and can't find my stored procedure. please advise
Just found the solution : exec("D:/wamp64/bin/mysql/mysql8.3.0/bin/mysqldump --routines=true --user={$user} --password={$pass} --host={$host} {$database} --result-file={$folder}", $output);
add --routines=true
Thanks again for sharing this script...
One question. How do you add more than one database on your $databases variable ?
The database variable is an array. I just added one database to the array. Multiple databases would look something like $databases = ['database1', 'database2', 'databse3'];
@@DreQueary awesome! Thank you Dude! 👍
php kinda reminds me of vb6 back in the day.
Hello, I have tried following you step by step but I am getting this error...Parse error: syntax error, unexpected 'C' (T_STRING) in the file location even after writing the same script as i followed yours.
Don't know since I can't see the code. But you need to check again. Error means you have a random C somewhere.
@@DreQueary Thank you, so much. I managed to solve this by using single quotes note double ones. But am getting this error "PHP Parse error: syntax error, unexpected end of file " . I closed all the brackets well but i have failed to trace this error. Please help me solve this.
I can't really help without seeing the code. But, make sure each bracket has a matching opening nd closing.
@@DreQueary The Code now shows no error at all but please, I need your help because when I run it, it keeps on running without stopping. How can i solve this. please help me.🙏
7:45 what will be the exec location for cpanel hosting?
I have no idea.
Is this code working on 5.6 PHP?
does this work using sublime text?
Yes
@@DreQueary
is this correct man? i have a database called gym_db.sql and yes it did back up but when i opened the backup in sublime it has no content
If it has no content in other editors, check your code. Otherwise, I don't know. But Sublime text does support SQL files.
@@DreQueary fixed it man hahah thank you for this