datajoint-matlab icon indicating copy to clipboard operation
datajoint-matlab copied to clipboard

Cannot connect to local database in 2024a

Open noamza opened this issue 1 year ago • 4 comments

Bug Report

I cannot connect to my local mysql database

Description

I couldn't see in the documentation https://datajoint.github.io/datajoint-docs-original/matlab/index.html how I am supposed to connect but running dj.conn() does not seem to work, regardless of setting name, pw, host.

Reproducibility

Include:

  • OS (WIN

  • MATLAB Version 2024a

  • MySQL Version 8.0.38

  • MySQL Deployment Strategy (local-native

  • DataJoint Version 3.5.1

  • Minimum number of steps to reliably reproduce the issue dj.conn()

  • Complete error stack as a result of evaluating the above steps

Error using mym SSL connection error: unknown error number

Error in [dj.Connection/query](matlab:matlab.lang.internal.introspective.errorDocCallback('dj.Connection/query', 'C:\Users\noama\AppData\Roaming\MathWorks\MATLAB Add-Ons\Toolboxes\DataJoint+dj\Connection.m', 167)) ([line 167](matlab: opentoline('C:\Users\noama\AppData\Roaming\MathWorks\MATLAB Add-Ons\Toolboxes\DataJoint+dj\Connection.m',167,0))) self.connId=mym(-1, 'open', self.host, self.user, self.password, self.use_tls);

Error in [dj.conn](matlab:matlab.lang.internal.introspective.errorDocCallback('dj.conn', 'C:\Users\noama\AppData\Roaming\MathWorks\MATLAB Add-Ons\Toolboxes\DataJoint+dj\conn.m', 107)) ([line 107](matlab: opentoline('C:\Users\noama\AppData\Roaming\MathWorks\MATLAB Add-Ons\Toolboxes\DataJoint+dj\conn.m',107,0))) query(connObj, 'status')

Expected Behavior

see schemas

Screenshots

Additional Research and Context

noamza avatar Jul 11 '24 15:07 noamza

I solved this by running the following on my mysql connection on localhost:

ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'newrootpassword'

and then connecting through dj with TLS set to false.

noamza avatar Jul 11 '24 16:07 noamza

I just ran into this issue as well, it is because inside of conn.m

elseif ~isstruct(use_tls)
    use_tls = 'none';

And the string 'none' is not handled. If you comment this out and or/change 'none' to 'false', it will work. Maybe one of the maintainers can let us know if that is a problematic fix, happy to make a PR if it seems useful.

stephenholtz avatar Nov 13 '24 19:11 stephenholtz

Thank you, @stephenholtz . We will review and merge. As you know, we are focusing on datajoint-python and your contribution to datajoint-matlab is most appreciated.

dimitri-yatsenko avatar Nov 13 '24 19:11 dimitri-yatsenko

Gotcha, I'll try to do it over the weekend

stephenholtz avatar Nov 14 '24 14:11 stephenholtz