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:
- 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.
- 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
- Create a symbolic link called mysql that links to the extracted folder using the following command:
ln -s mysql-connector-c-version mysql
- 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
PROC DATASETS LIBRARY=DATASRC;
- 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.