Create and Schedule Automatic MySQL Database Backups In PHP

Sdílet
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

Komentáře • 23

  • @mackiver1685
    @mackiver1685 Před 8 měsíci +3

    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

  • @ivangs8082
    @ivangs8082 Před 2 lety +3

    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.

  • @nirmaltech2043
    @nirmaltech2043 Před 3 lety +2

    Nice

  • @ucoktrosmada5145
    @ucoktrosmada5145 Před měsícem

    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

    • @ucoktrosmada5145
      @ucoktrosmada5145 Před měsícem

      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...

  • @alphamx13
    @alphamx13 Před 2 lety +1

    One question. How do you add more than one database on your $databases variable ?

    • @DreQueary
      @DreQueary  Před 2 lety +2

      The database variable is an array. I just added one database to the array. Multiple databases would look something like $databases = ['database1', 'database2', 'databse3'];

    • @alphamx13
      @alphamx13 Před 2 lety

      @@DreQueary awesome! Thank you Dude! 👍

  • @copykon
    @copykon Před 2 lety +1

    php kinda reminds me of vb6 back in the day.

  • @immaculateatim4507
    @immaculateatim4507 Před 2 lety +1

    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.

    • @DreQueary
      @DreQueary  Před 2 lety

      Don't know since I can't see the code. But you need to check again. Error means you have a random C somewhere.

    • @immaculateatim4507
      @immaculateatim4507 Před 2 lety

      @@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.

    • @DreQueary
      @DreQueary  Před 2 lety

      I can't really help without seeing the code. But, make sure each bracket has a matching opening nd closing.

    • @immaculateatim4507
      @immaculateatim4507 Před 2 lety

      @@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.🙏

  • @SkjoyBd
    @SkjoyBd Před 2 lety +1

    7:45 what will be the exec location for cpanel hosting?

  • @shamsulhaq7250
    @shamsulhaq7250 Před 2 lety

    Is this code working on 5.6 PHP?

  • @aiveralvarez1952
    @aiveralvarez1952 Před 5 měsíci

    does this work using sublime text?

    • @DreQueary
      @DreQueary  Před 5 měsíci +1

      Yes

    • @aiveralvarez8275
      @aiveralvarez8275 Před 4 měsíci

      @@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

    • @DreQueary
      @DreQueary  Před 4 měsíci

      If it has no content in other editors, check your code. Otherwise, I don't know. But Sublime text does support SQL files.

    • @aiveralvarez8275
      @aiveralvarez8275 Před 3 měsíci

      @@DreQueary fixed it man hahah thank you for this