Jump to content

How to save MySql database dayly (automatically)


SergioFeitoza

Recommended Posts

Há 2 horas, SergioFeitoza disse:

Meu código Unigui está sendo executado como um serviço i tne web. Ele usa um pequeno banco de dados MySql . Como fazer um código para fazer backup diário do banco de dados, por exemplo, um arquivo *.sql?

You can create a bat file with the backup script and schedule on windows

Link to comment
Share on other sites

The batch file as following:

Backup.bat

set datestr=%date:~6,4%-%date:~3,2%-%date:~0,2%

"C:\Program Files\MySQL\MySQL Server 8.0\bin\mysqldump.exe" -uUser -pPassword --databases DB1 DB2 > f:\bk\Backup_%datestr%.sql;
exit

Then create a job on Windows Task Scheduler to run the batch file on daily basis, if the database on linux, create a cron job for it.

 

Link to comment
Share on other sites

2 hours ago, Mohammed Nasman said:

The batch file as following:

Backup.bat


set datestr=%date:~6,4%-%date:~3,2%-%date:~0,2%

"C:\Program Files\MySQL\MySQL Server 8.0\bin\mysqldump.exe" -uUser -pPassword --databases DB1 DB2 > f:\bk\Backup_%datestr%.sql;
exit

Then create a job on Windows Task Scheduler to run the batch file on daily basis, if the database on linux, create a cron job for it.

 

Thank you Mohamed . I will check how to do this. Possibly is one of the possibilities detailled in the link above posted by x11

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...