Connecting to a MySQL database from Altair SLC on Linux


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 wps.conf in that folder, and add the line /opt/mysql/lib to the wps.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;