Using MySQL with LabVIEW

Updated Feb 18, 2019

Reported In


  • LabVIEW
  • LabVIEW Database Connectivity Toolkit


LabVIEW Database Connectivity Toolkit

Issue Details

I need to build a LabVIEW application that can communicate with a MySQL database. Is that possible?


It is possible to establish a connection from LabVIEW to a MySQL database.
An easy way to implement a connection is by using the LabVIEW Database Connectivity Toolkit which offers a set of VIs that implement important database operations.

The following steps explain how to connect to a MySQL database with the LabVIEW Database connectivity toolkit.
  1. Download and install the ODBC database driver from MySQL
  2. Add the MySQL ODBC driver to the list of data sources on your development computer by going  to Start»Control Panel»Administrative Tools»Data Sources (ODBC) (select the correct bit version)
  3. Click the Drivers tab and ensure that MySQL ODBC driver is listed
  4. Click on the User DSN tab and select Add.                                                                                                                 
  5. Select the MySQL ODBC Driver. Consult the installation instructions to determine if you should use the Unicode or ANSI driver. Click Finish.
  6. Provide the connection parameters for your MySQL server. Click Test. If testing the connection fails, ensure that all the parameters are correct and that the application can connect to the MySQL server if it is running on a network computer.                                                                 
To connect to your MySQL database with DB Tools Open in LabVIEW, allow the VI to prompt you to manually select the data source or provide the name of the data source you defined in step 6 above.

Prompt for data source​
  1. Wire a True to the prompt input of DB Tools Open Connection VI
  2. When the VI runs, choose Microsoft OLE DB Provider for ODBC Drivers in the Provider tab. Select Next
  3. Select your data source in Use data source name. Select OK                                                                                  

Provide data source name
Provide the data source name you specified in Step 6 above into the connection information input via a string constant.

Additional Information