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

10 hours ago, SergioFeitoza said:

My Unigui code is running as a service i tne web. It uses a small MySql database .  How to do a code to backup dayly the database, for example a a *.sql file ?

I use a batch file that uses mysqldump.exe & Windows Task Scheduler.

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

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...