Not successful connection to MySQL (native data source configuration)

18 ビュー (過去 30 日間)
Mohammad Alavirad
Mohammad Alavirad 2021 年 8 月 27 日
コメント済み: Punpiti Piamsa-nga 2022 年 1 月 11 日
Hi folks
I am trying to querry data from a native source SQL using Database Explorer as below:
The parameters are set properly (this is verified using a Python API before)
When I test this connection, it takes forever and no response received. Looks like connection is not successful.
Any input is much appreciated.

回答 (3 件)

Kojiro Saito
Kojiro Saito 2021 年 8 月 30 日
As written in this document, please make sure that you have installed MySQL Connector/C++ 8.0.15 driver.
The native driver installer is linked from here.
MySQL Native Interface
You need to install the appropriate driver for your operating system. For the Windows® and macOS operating systems, use this link to download and install the driver. For Linux®, use this link.
Also, please make sure that you've added the path of driver libraries (by default in Windows, the path would be C:\Program Files\MySQL\Connector C++ 8.0\lib64).
setenv('PATH', [getenv('PATH') ';C:\Program Files\MySQL\Connector C++ 8.0\lib64']);
Or, add "C:\Program Files\MySQL\Connector C++ 8.0\lib64" to Windows System Path.
After that, I think you can avoid hang-up.
  3 件のコメント
Kojiro Saito
Kojiro Saito 2021 年 8 月 31 日
OK, so the connector setting looks good to me.
It's simliar to this issue.
How about deleting preference directory?
will return MATLAB's preference directory.
(ex, C:\Users\USENAME\AppData\Roaming\MathWorks\MATLAB\R2021a)
Deleting this preference directory and relaunching MATLAB might solve this issue.
If not, you had better re-install MATLAB.


Mohammad Alavirad
Mohammad Alavirad 2021 年 8 月 30 日
編集済み: Mohammad Alavirad 2021 年 8 月 30 日
Thank you @Kojiro Saito for your message. I followed your instructions and this time and tested the connection in two ways:
1) I used Database Explorer App and got this error in Matlab Command Window (at least I saw something!!), the Test window still hanging up though...
Error using matlab.ui.control.internal.controller.ComponentController/executeUserCallback (line 410)
Error while evaluating Button PrivateButtonPushedFcn.
2) I also used the script to test my connection to SQL database and recieved this error message:
Loading C:\Program Files\MATLAB\R2021a\bin\win64\builtins\database_builtins\mwlibmysql_builtinimpl.dllfailed with error: The specified module could not be found.
: not connected: not connected
I checked the directory and the *.dll is there:
Any advise would be greatly appreciated.
  1 件のコメント
Punpiti Piamsa-nga
Punpiti Piamsa-nga 2022 年 1 月 11 日
I get the same problem.


zhuofei wu
zhuofei wu 2021 年 9 月 20 日
This vedio should be helpful.
  1 件のコメント
Walter Roberson
Walter Roberson 2021 年 9 月 20 日
(Video is about how to connect MATLAB to a database)





Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by