Q100567: How to restore a Flix database backup

SUMMARY


This article explains how to restore a backup of a Flix database schema.
 

MORE INFORMATION


Although the Flix Server can be prompted to back up the database it's using, it currently cannot restore a backup file. This has to be done via MySQL instead.

Here are some recommendations to achieve this: 

  • Some communication packets sent to the MySQL server while restoring a Flix database backup will exceed MySQL’s default max_allowed_packet value of 4MB, resulting in a MySQL Server error during the process. To avoid this, ensure your MySQL server’s max_allowed_packet variable is set to a higher value depending on your database size (for example 130MB).
    More information about MySQL’s max_allowed_packet variable and how to set it can be found in the MySQL documentation.
  • Some data in the Flix database backup will contain \0 (null) characters, which MySQL won’t be able to process unless the --binary-mode option is toggled on.

The required format for the MySQL command to run to restore a Flix database backup will be the following:

mysql -h <host IP> -u<username> -p<password> --binary-mode=1 <schema> < <path to backup file.sql>

 

If you need to restore from a gzipped backup, you can run the following:

gzip -d -c <path to backup file.sql.gz> | mysql -h <host IP> -u<username> -p<password> --binary-mode=1 <schema> 

 

Below is an example command to restore the flix.sql backup file, located in /home/flix_sql_backups/, to a pre-existing ‘flix’ schema, available on a database server running on IP 10.0.0.101:

mysql -h 10.0.0.101 -umy_user -pP@ssw0rd --binary-mode=1 flix </home/flix_sql_backups/flix.sql

 

And another example command to restore a gzipped flix.sql.gz backup file, located in /home/flix_sql_backups/, to a pre-existing ‘flix’ schema, available on a database server running on IP 10.0.0.101:

gzip -d -c /home/flix_sql_backups/flix.sql.gz | mysql -h 10.0.0.101 -umy_user -pP@ssw0rd --binary-mode=1 flix

This operation may take some time, depending on the amount of data in your Flix database backup.

 

FURTHER READING


You can learn how to set up a Flix Server from the Installing Flix Server section of Flix's documentation.  

The Q100615: Backing up Flix KB article explains how to back up your Flix environment.

    We're sorry to hear that

    Please tell us why