Tag Archive for mysql

MySQL Backup Engine

Finally, I got around to updating my database backup utility! I started by creating a MySQL connection library and a “Backup Engine” library, which I hooked up to a test console app. This approach will allow me to have two different applications that use the same back end. One application will be a windows client and the there will be a command line utility as well.

The original version was created over a year ago and hasn’t been worked on until now.

The new project consists of:

  • Database connection library
  • Database Backup engine
  • Commandline app
  • Windows forms app

It saves backup into .sql files of predefined size. I created a DynamicFile class which saves text data into multiple files and allows the programmer to get the list of filenames afterwards:

Actually, I extended this class into DynamicSqlFile and created some methods useful for writing SQL files:

It has a handful of useful methods, like WriteComment(), which automatically appends “– ” before the text and ends it with a NewLine character. It also returns and instance of itself, making this possible:

Which makes for very compact and readable code. It ends up looking like this in the SQL file:

Commandline interface:


Work in progress

Work in progress

MySQL backup


This is a little utility I created using Visual C#. I use it to backup my server’s database every day. It can remember any number of mysql databases with credentials in an xml file. Backups are done manually by pressing the button.

Database manager

Database manager

This utility creates backup by querying server for detailed list of tables, and then selects all data from each table, 1000 rows at a time to avoid locking up database while gameserver still needs access to it. Data is saved to .sql files, which size is limited to certain size. After this, another file is created and backup is continued.

Main program window

Main program window