Main Content

MySQLNative 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®andmacOSplatforms only.

Objects

connection MySQLnative interface database connection
SQLConnectionOptions DefineMySQLnative interface database connection options

Functions

expand all

databaseConnectionOptions Create database connection options
rmoptions RemoveMySQLnative interface connection options
saveAsDataSource SaveMySQLnative interface data source
setoptions SetMySQLnative interface connection options
reset ResetMySQLnative interface connection options to defaults
testConnection TestMySQLnative interface database connection
mysql CreateMySQLnative interface database connection
close CloseMySQLnative interface database connection
isopen Determine ifMySQLnative interface database connection is open
sqlfind Find information about all table types inMySQLdatabase
fetch 导入SQL语句的结果MySQLdatabase intoMATLAB
sqlread Import data intoMATLABfromMySQLdatabase table
sqlinnerjoin Inner join between twoMySQLdatabase tables
sqlouterjoin Outer join between twoMySQLdatabase tables
executeSQLScript 执行SQL脚本MySQLdatabase
databaseImportOptions Define import options for database data
getoptions Retrieve import options for database data
preview Preview eight rows from database using import options
setoptions Customize import options for database data
reset Reset to default import options for database data
databaseDatastore Datastore for data in database
hasdata Determine if data inDatabaseDatastoreis available to read
preview Return subset of data fromDatabaseDatastore
read Read data inDatabaseDatastore
readall Read all data inDatabaseDatastore
reset ResetDatabaseDatastoreto initial state
splitsqlquery Split SQL query using paging
createConnectionForPool Initialize parallel pool using database connection
sqlwrite InsertMATLABdata intoMySQLdatabase table
execute Execute SQL statement usingMySQLnative interface database connection
commit Make changes toMySQLdatabase permanent
rollback Undo changes toMySQLdatabase

Topics

ConfigureMySQLNative 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 formacOS.

Import Data intoMATLAB

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 aDatabaseDatastoreobject for accessing collections of data stored in a MySQL database.

Export Data fromMATLAB

Insert Data into Database Table Using MySQL Native Interface

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

Execute Database Operations

Create Table and Add Column Using MySQL Native Interface

Manage MySQL database structures using theCREATEandALTERSQL statements.

Delete Data from Database Using MySQL Native Interface

删除的数据a MySQL database using MATLAB.

Roll Back Data in Database Using MySQL Native Interface

Execute theROLLBACKSQL statement to reverse changes in a MySQL database by using theexecutefunction.

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.