Effacer les filtres
Effacer les filtres

Unable to connect to MySQL (native data source configuration) on iMac

14 vues (au cours des 30 derniers jours)
Simon
Simon le 12 Juil 2022
Réponse apportée : Simon le 27 Mar 2023
[My Computer Setup]
iMac Pro OSX 12.4 Montery
MySQL/C++ connector has been installed by brew as well as by .dmg package. The path to the brew-installed library and the path to the dmg-installed library have been added to the PATH variable in .zshrc.
I am the sole user and administrator of my computer and the MySQL server.
———————————————
[Connection to MySQL native with script]
First, I tried connection with script.
vendor = "MySQL";
opts = databaseConnectionOptions("native",vendor);
testdb = "/Users/simon/testdb.sql";
opts = setoptions(opts, ...
'DataSourceName',"MySQLDatSource", ...
'DatabaseName', testdb,'Server',"localhost", ...
'PortNumber',3306)
username = "xxxxxx";
password = "xxxxxx";
s = testConnection(opts,username,password)
[Error Message]
I received this error message:
Failed to load bundle #324:
/Applications/MATLAB_R2022a.app/bin/maci64/libmwlibmysql.dylib
though this .dylib file exists in that folder.
[Connection to MySQL native with Database Explorer app]
Then, I tried Database Explorer app. I chose native mode for MySQL, and typed in localhost, port number 3306, same information as what I used in the scropt. I clicked ‘Test’ and typed in for Username and Password in the prompt window. The ‘Test Connection’ showed a spinning wheel runing forever and ever.
———————————————
[Failed effort to resolve the problems]
I had tried two solutions suggested in the Mathworks community. Both failed.
failed solution 1.) I copied the unloadable file, libmwlibmysql.dylib, to the working directory of my script. Didn’t work.
failed solution 2.) While some had suggested copying the library file to /usr/lib, Apple computer did not permit that owing to the security mechanism on Mac OS.
[MySQL/JDBC connectoin]
This connection passed the 'Test Connection' stage. But when I made a connection with a database, I received a different error message. This is a different issue, so I would not elaborate it here.

Réponse acceptée

Simon
Simon le 27 Mar 2023
After I upgrade Matlab to 2023a, this problem is gone. I now can connect to MySQL server with "native" mode. Thanks to Mathworks team for making it work.
conn = mysql(username, password)

Plus de réponses (0)

Produits


Version

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by