Skip to Main Content
HBS Home
  • About
  • Academic Programs
  • Alumni
  • Faculty & Research
  • Baker Library
  • Giving
  • Harvard Business Review
  • Initiatives
  • News
  • Recruit
  • Map / Directions
Research Computing Services
  • Online Requests
  • FAQ
  • Blog
  • Contact Us
  • About Us
  • Faculty Projects
  • Training
  • Compute Cluster & Data Storage
  • Data Practices
  • Help
  • …→
  • Harvard Business School→
  • Research Computing Services→
  • Data Practices
    • Data Practices
    • Best Practices
    • Data Tips & Toolkits
    • Database Best Practices
    • Transferring Data
    →
  • Database Best Practices
    • Database Best Practices
    • Delimiters
    • Exporting
    • Import & Export of Text Files
    • Importing
    →
  • Import & Export of Text Files→

Database Best Practices

Database Best Practices

  • Delimiters
  • Exporting
  • Import & Export of Text Files
  • Importing

Import & Export of Text Files

Import & Export of Text Files

  • Best Practices
  • Data Tips & Toolkits
  • Database Best Practices
    • Delimiters
    • Exporting
    • Import & Export of Text Files
    • Importing
  • Transferring Data
4ms

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
ǁ
Campus Map
Research Computing Services (RCS) 
Harvard Business School
Baker Library, B90, 25 Harvard Way
Boston, MA 02163
Phone: 617.495.6100
Email: research@hbs.edu
→Map & Directions
→More Contact Information
→Terms Of Service
  • Make a Gift
  • Site Map
  • Jobs
  • Harvard University
  • Trademarks
  • Policies
  • Accessibility
  • Digital Accessibility
Copyright © President & Fellows of Harvard College