Right now I might be displaying tips on how to arrange automated database backup with out putting in further scripts to your FiveM server.

This methodology has solely been examined on Home windows however the thread incorporates a LINUX CRON job information, suggestions is appreciated.

Required

  • Server with distant entry ( Distant desktop connection for Home windows, Putty for Linux )
  • MySQL [ Windows / Linux ]
  • SQL consumer ( HeidiSQL )
  • Notepad++ or every other modifying instrument

Used on this instance

  • Home windows server 2019
  • MySQL 8.0

Log in to your SQL server utilizing your SQL consumer, on this case I might be utilizing HeidiSQL


gCNReK0


When Heidi connects to the server, choose “Question” tab.
It needs to be the primary tab to the correct of the server tab.


majOzlc

Copy&Paste the question beneath into the textual content area after which change ‘username’, ‘password’ and ‘yourdatabase’ to values you need.


CREATE USER 'newuser'@'localhost' IDENTIFIED BY 'password';
GRANT PROCESS ON *.* TO `newuser`@`localhost`;
GRANT SELECT ON `yourdatabase`.* TO `newuser`@`localhost`;

Hit F9 or the blue play button to run your question.


Create a brand new folder referred to as “fiveMbackup” within the root of your C: drive (C:fiveMbackup) or wherever you need (you’ll have to change parameters in code beneath).

Scroll down in case you are utilizing Linux.

Open N++, create a brand new file, add:

cd C:Program FilesMySQLMySQL Server 8.0bin
mysqldump -uexampleusername -pexamplepassword yourdatabase --single-transaction --quick --lock-tables=false > C:fiveMbackupfiveMbackup_percentdate:~-10,2%-%date:~-7,2%-%date:~-4,4%.sql
QUIT

Don’t take away -u and -p from uexampleusername -pexamplepassword!
Change solely the textual content after -u and -p!

Save as .bat contained in the folder you created.

Take a look at your .bat file, if every part is working proper it’s best to see a brand new file within the folder referred to as “fiveMbackup_MM_DD_YYYY.sql”.


WINDOWS
Open Process Sheduler and create a brand new fundamental process (observe steps on .GIF beneath)

f1JaaXW

LINUX (source)

Open terminal and sort:

sudo tcsh
nano /and so forth/crontab

Add the next line will schedule the backup at 1 AM every day, change the parameters to those you may be utilizing.

0 1 * * * /usr/native/mysql/bin/mysqldump -uroot -ppassword --opt database > /path/to/listing/filename.sql

Helpful CRON documentation.


That’s it, you’re accomplished!
You’ll be able to take a look at in case your process works by proper clicking the duty in Process Scheduler and clicking “Run”.

Thanks for studying, for those who need assistance with setting this up please submit a reply within the thread!



Looking for a FiveM Server host? Click here