MariaDB Backup Loading Methods - MariaDB

What are the backup loading methods available in MariaDB?

Here you will learn about various backup loading methods available in MariaDB. It is a simple process to restore the data to a database from a backup and sometimes terribly long process.
There are three options available to load data:
  • The LOAD DATA statement
  • Mysqlimport,
  • Simple mysqldump restore

Using LOAD DATA

The LOAD DATA statement functions as a bulk loader. Here’s an example to load data in to a text file –
Note the following qualities of a LOAD DATA statement −
  • Use the LOCAL keyword to prevent MariaDB from performing a deep search of the host, and use a very specific path.
  • The statement assumes a format consisting of lines terminated by linefeeds (newlines) and data values separated by tabs.
  • Use the FIELDS clause to explicitly specify formatting of fields on a line. Use the LINES clause to specify line ending. Review an example below.
  • The statement assumes columns within the datafile use the same order of the table. If you need to set a different order, you can load the file as follows –

Using MYSQLIMPORT

The mysqlimport tool is useful as a LOAD DATA wrapper allowing the same operations from the command line.
Load data as follows –
Specify formatting as follows –
Use the --columns option to specify column order –

Using MYSQLDUMP

Restoring with mysqldump requires this simple statement for loading the dump file back into the host –

SPECIAL CHARACTERS AND QUOTES

In a LOAD DATA statement, quotes and special characters may not be interpreted correctly. The statement assumes unquoted values and treats backslashes as escape characters. Use the FIELDS clause to specify formatting. Point to quotes with “ENCLOSED BY,” which causes the stripping of quotes from data values. Change escapes with “ESCAPED BY.”

All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd DMCA.com Protection Status

MariaDB Topics