Skip to content

Latest commit

 

History

History

MySQL

README.md

SNOMED CT DATABASE

MYSQL SQL Scripts to create and populate a MYSQL database with a SNOMED CT terminology release

Minimum Specification

  • MYSQL v8.x

Scripted Installation (Mac & Unix)

Before you start

The server must allow loading local files (local_infile), which is OFF by default from MySQL 8.0. Check with SHOW GLOBAL VARIABLES LIKE 'local_infile'; and, if it's OFF, run SET PERSIST local_infile = 1; as an admin user. The script checks this after asking for your database credentials and stops if it's not enabled. See Issues below for the error you'll get otherwise.

Running the script

run load_release.sh

eg ./load_release.sh ~/Backup/SnomedCT_RF2Release_INT_20150731.zip SCT_20150731 SNAP

Release packages no longer include Delta files. If a package has no Concept Delta file, the script says so once and loads only Snapshot and/or Full. To load whatever Delta files a package does contain (eg a translation package, which has Delta descriptions but no Concept file), add --force-delta:

eg ./load_release.sh ~/Backup/SnomedCT_SomeTranslation_20261001.zip TRANS_20261001 DELTA --force-delta

Note that the scripted installation will now support loading other Editions. The script asks for a module identifier, which is INT by default, for the international edition. Loading the US Edition, for example, would work as follows: Enter module string used in filenames [INT]: US1000124

Manual Installation

  1. Download the SNOMED CT terminology release from the IHTSDO web site
  2. Create the database using the db appropriate create-database.sql script or skip/perform this action manually if you'd like the data to be loaded into a existing/different database.
  3. Create the tables using the db appropriate environment.sql script. The default file creates tables for full, snapshot and delta files and there's also a -full-only version.
  4. Edit the db appropriate load.sql script with the correct location of the SNOMED CT release files An alternative under unix or mac would be to create a symlink to the appropriate directory eg ln -s /your/snomed/directory RF2Release
  5. Load the database created using the edited load.sql script from the relevant command prompt, e.g. mysql> source load.sql or via the relevant management tool (tested in both phpmyadmin and mysqlworkbench).
  • again by default for full, snapshot and delta unless you only want the full version.

NB If you're using mysql 5.5 or above then you'll need to start that with the following command in order to allow local files to be loaded: mysql -u [your_user] -p --local-infile

Issues

If you see either of the following errors:

  • ERROR 1148 (42000) at line 2 in file: 'tmp_rf1_loader.sql': The used command is not allowed with this MySQL version
  • ERROR 3948 (42000) at line 3 in file: 'tmp_loader.sql': Loading local data is disabled; this must be enabled on both the client and server sides (MySQL 8 and later)

This is a security feature of MYSQL to prevent local files being loaded. The load script includes an argument of "--local-infile" when starting the client application, so it is the server side that must also permit it. Check with SHOW GLOBAL VARIABLES LIKE 'local_infile'; and, if it is OFF, either:

  • run SET PERSIST local_infile = 1; as a user with SYSTEM_VARIABLES_ADMIN (MySQL 8 and later, survives a restart), or
  • add the following block to the server config file and restart MySQL (eg /etc/mysql/my.cnf or /usr/local/etc/my.cnf, which you may need to create. Type mysqld --verbose --help | grep -A1 "Default options" for the expected config locations): [mysqld] local_infile=1

See http://stackoverflow.com/questions/10762239/mysql-enable-load-data-local-infile