Automatic MySQL / PostgreSQL Backups with a Shell Script and Cron Job

Поделиться
HTML-код
  • Опубликовано: 12 сен 2024

Комментарии • 26

  • @nnutipa
    @nnutipa 4 года назад +2

    Great video as always! Thanks a lot! It would be nice to have in it a little section about backup behavior under the load (like tables locking, etc.).

    • @NickJanetakis
      @NickJanetakis  4 года назад +2

      Hi, oh yeah that will depend on which DB you're using. For example pg_dump will still allow connections while a dump is going.

    • @nnutipa
      @nnutipa 4 года назад +1

      @@NickJanetakis yeah I know, just mentioned this, because somebody might not

  • @ic3xiii
    @ic3xiii 4 года назад +1

    thank you! will try this on a Shared Dreamhost instance on my custom app.

  • @samuelolmedo3682
    @samuelolmedo3682 2 года назад +1

    very useful video, thank you

  • @fluffyfetlocks
    @fluffyfetlocks 2 года назад +1

    The main reason to not show your MySQL credentials of your live server on RUclips is because it makes it easier to exploit an injection attack if Sendy ever becomes vulnerable, since injected PHP code will still be run as "localhost"

  • @Trade-Max
    @Trade-Max 2 года назад +2

    Очень круто, молодец.

  • @Anti4pok
    @Anti4pok 2 года назад +1

    very useful, thx !

  • @rajuponthapalli2871
    @rajuponthapalli2871 Год назад

    Hello Nick,
    How to call SQL file(PostGresql) from shell script ?
    Could you please share a snippet for calling sql file from shell script.
    Thanks & Regards
    Raju

    • @NickJanetakis
      @NickJanetakis  Год назад

      Hi, you mean importing a SQL file into postgres? There's an example of that in the gist linked in the description: gist.github.com/nickjj/00b07e522caee02e37951ec6de2a9c95#file-sendy-restore-L39

  • @solongsucker666
    @solongsucker666 3 года назад

    What if I wanna backup from different server? What do I have to add to the script? And, do I have to install odbc something like that, so destination server can recognize mysql database in other server?

    • @NickJanetakis
      @NickJanetakis  3 года назад

      The mysql command has a "host" flag where you can set the server (host) you want to connect to. No other tools need to be installed.

  • @aaronpirc7972
    @aaronpirc7972 4 года назад +1

    You look and sound just like Buster from Arrested Development lol

    • @NickJanetakis
      @NickJanetakis  4 года назад +2

      I've never seen that show before. Before looking up the character I thought "wow, what a nice compliment". After looking up the character on fandom, now I'm freaked out because some of his character's description could be in my biography.

    • @aaronpirc7972
      @aaronpirc7972 4 года назад +1

      @@NickJanetakis By any means did I mean that as an insult either! I love Buster, highest of all compliments :) also on a more relevant matter, your video helped me so much! Very simple yet effective

    • @akhillshetty2140
      @akhillshetty2140 3 года назад +1

      @@NickJanetakis This is hilarious!

  • @umarsharief3683
    @umarsharief3683 3 года назад

    HI @Nick Janetakis ...... !!!! For (POSTGRES) I need to compress the archive log files (WAL files) in various location kindly and delete the older WAL files periodically... Kindly suggest a better way to compress it in corn job or in manual command...
    If your willing kindly put a video belongs to this Postgres archive (compression)
    and do more videos on Postgres DB

    • @NickJanetakis
      @NickJanetakis  3 года назад

      Hi, the postgres solution provided in this video will compress the file. That's what the -c flag does.

    • @umarsharief3683
      @umarsharief3683 3 года назад

      @@NickJanetakis
      Sry, could you provide the link 🔗 pls buddy...

    • @NickJanetakis
      @NickJanetakis  3 года назад

      @@umarsharief3683 It's near the top of the description gist.github.com/nickjj/00b07e522caee02e37951ec6de2a9c95.

  • @vijaydynamo4050
    @vijaydynamo4050 11 месяцев назад

    Does it work for mssql??

    • @NickJanetakis
      @NickJanetakis  11 месяцев назад

      It depends. If you're running everything on Windows you'd likely want to use PowerShell and Windows scheduled tasks but the same concepts would apply. If you're calling the mssql client from Linux then everything here would work except you'd only need to change the mysql/postgres commands to use mssql.

    • @vijaydynamo4050
      @vijaydynamo4050 11 месяцев назад

      @@NickJanetakis thanks will try it..