MySQL Native Interface

Interact with a MySQL® database using the MySQL native interface

Create a data source and connect to a MySQL database. Explore data and import data from the database into MATLAB®. Export data from MATLAB into the database. Explore and import data using the Database Explorer app or the command line.

The MySQL native interface is supported on the Windows® and macOS platforms only.

Objects

connectionMySQL native interface database connection
SQLConnectionOptionsDefine MySQL native interface database connection options

Functions

expand all

databaseConnectionOptionsCreate database connection options
rmoptionsRemove MySQL native interface connection options
saveAsDataSourceSave MySQL native interface data source
setoptionsSet MySQL native interface connection options
resetReset MySQL native interface connection options to defaults
testConnectionTest MySQL native interface database connection
mysqlCreate MySQL native interface database connection
closeClose MySQL native interface database connection
isopenDetermine if MySQL native interface database connection is open
sqlfindFind information about all table types in MySQL database
fetchImport results of SQL statement in MySQL database into MATLAB
sqlreadImport data into MATLAB from MySQL database table
sqlinnerjoinInner join between two MySQL database tables
sqlouterjoinOuter join between two MySQL database tables
executeSQLScriptExecute SQL script on MySQL database
databaseImportOptionsDefine import options for database data
getoptionsRetrieve import options for database data
previewPreview eight rows from database using import options
setoptionsCustomize import options for database data
resetReset to default import options for database data
databaseDatastoreDatastore for data in database
hasdataDetermine if data in DatabaseDatastore is available to read
previewReturn subset of data from DatabaseDatastore
readRead data in DatabaseDatastore
readallRead all data in DatabaseDatastore
resetReset DatabaseDatastore to initial state
splitsqlquerySplit SQL query using paging
createConnectionForPoolInitialize parallel pool using database connection
sqlwriteInsert MATLAB data into MySQL database table
executeExecute SQL statement using MySQL native interface database connection
commitMake changes to MySQL database permanent
rollbackUndo changes to MySQL database

Topics

Configure MySQL Native Interface

MySQL Native Interface for Windows

Configure a MySQL native interface data source for a MySQL database for Windows.

MySQL Native Interface for macOS

Configure a MySQL native interface data source for a MySQL database for macOS.

Import Data into MATLAB

Import Data from MySQL Database Table

Import data from one table by using various functions.

Customize Options for Importing Data from Database into MATLAB Using MySQL Native Interface

Customize import options for multiple variables when importing data from a MySQL database.

Import Large Data Using DatabaseDatastore Object and MySQL Native Interface

Create a DatabaseDatastore object for accessing collections of data stored in a MySQL database.

Export Data from MATLAB

Insert Data into Database Table Using MySQL Native Interface

Perform calculations on data and insert the results into a MySQL database using the sqlwrite function.

Execute Database Operations

Create Table and Add Column Using MySQL Native Interface

Manage MySQL database structures using the CREATE and ALTER SQL statements.

Delete Data from Database Using MySQL Native Interface

Delete data from a MySQL database using MATLAB.

Roll Back Data in Database Using MySQL Native Interface

Execute the ROLLBACK SQL statement to reverse changes in a MySQL database by using the execute function.

Deploy Standalone Database Application

Deploy MySQL Native Interface Database Application with MATLAB Compiler

Write a MATLAB script that connects to a MySQL database and deploy the script as a standalone database application to other machines.