Connecting to a MySQL database from Altair SLC on Linux

IanBD
IanBD
Altair Employee
edited October 15 in Altair RapidMiner

If you have data stored in a MySQL database, you can connect using the MySQL Connector/C client. To install the client you need to:

  1. Download the MySQL Connector/C client from the MySQL Download Connector/C page of the MySQL website.
    Make sure you select the correct Linux distribution and architecture to match the Altair SLC installation.
  2. Once the file is downloaded, change directory (cd) to the /opt folder and extract the contents using the following command:
    tar xzf download-path/mysql-connector-c-version.tar.gz
    • Where download path is the absolute path to the download location, and version is the downloaded version of the MySQL Connector/C client.
    • When complete, the MySQL connector archive is unpacked into the /optfolder
  3. Create a symbolic link called mysql that links to the extracted folder using the following command:
    ln -s mysql-connector-c-version mysql
  4. Add the MySQL libraries to the shared library cache, to do this:
    • Change directory (cd) to the /etc folder.
    • View the contents of the ld.so.conf file.
      • If ld.so.conf references a separate folder through an include statement:
        Create a file called slc.conf in that folder, and add the line /opt/mysql/lib to the slc.conf file.
      • If ld.so.conf contains a list of folders:
        Add the line /opt/mysql/lib to the file.
      • Run ldconfig.

Test the database connectivity with the following SAS language program:

LIBNAME DATASRC MYSQL USER=user-name PASSWORD=password 
SERVER=remote-id DATABASE=dbase;
PROC DATASETS LIBRARY=DATASRC;
RUN;
  • In the LIBNAME statement, replace user-name and password with your user name and password for the remote-id server, and replace dbase with the name of the MySQL database.
  • The DATASETS procedures returns the names of all tables in the selected database; for databases with large numbers of tables, this program might take some time to run.