Import and Export of Text Files

The MariaDB server is able to import text files and export data to a text file. Users are encouraged to use the bulk import and export features due to speed. In particular for large datasets, bulk import of data from a file is much faster than line-by-line insert queries. Please note that RCS has specific restrictions on where the files may be imported from, or exported to.

Restrictions

The MariaDB server can only import from or export to folders within

/export/mdb_external/

Users are meant to use /export/mdb_external/import/ for importing text files. Similarly, users are meant to use /export/mdb_external/export/ for exporting data into a file.

Prevent Others From Accessing Your Data

Files within /export/mdb_external/ are visible to other users by default. To prevent others from accessing your data, users are encouraged to create a temporary folder and then limit access to this folder.

Create the folder temp_folder within the import directory:

mkdir /export/mdb_external/import/temp_folder

Prevent all other users from accessing the contents of this folder

            chmod 700 /export/mdb_external/import/temp_folder

Log into MariaDB and import test_file from temp_folder via the SQL command:

            LOAD DATA INFILE ‘temp_folder/test_file‘ INTO TABLE …

Once the import has completed, exit out of MariaDB and remove your temporary files:

            rm -rf /export/mdb_external/import/temp_folder

Please note that for data export, during the export process you must set the folder to be Read+Writable to everyone via chmod 777. If you do not, then the MariaDB server cannot access the folder. Users should monitor their export status such that they may lock the folder (via chmod 700) as soon as the export has completed.

            chmod 777 /export/mdb_external/export/temp_folder