MATLAB Answers


How can I connect matlab to mysql?

Asked by Tomas
on 10 Nov 2012

How can I connect matlab to mysql using ODBC?

  1 Comment

Use the Database toolbox.

What have you tried? In what ways didn't it meet your expectations?

1 Answer

Answer by David Barry
on 11 Nov 2012

As Sven suggests, you should use the functions within the Database Toolbox - assuming of course that you have this toolbox. The help documents are very good and have some examples that should get you going. Please upload your code if you are still struggling.


can you give me steps because i tried to do this

conn = database('localhost','root','')
a = isconnection(conn)

but i get this result

conn =
         Instance: 'localhost'
         UserName: 'root'
           Driver: []
              URL: []
      Constructor: [1x1 com.mathworks.toolbox.database.databaseConnect]
          Message: [1x166 char]
           Handle: 0
          TimeOut: []
       AutoCommit: 'off'
             Type: 'Database Object'
a =

What does conn.Message contain?

Join the 15-year community celebration.

Play games and win prizes!

Learn more
Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

MATLAB Academy

New to MATLAB?

Learn MATLAB today!