Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dj.set_password does not work in Frank Lab production database (MySQL 8) #639

Closed
rly opened this issue Sep 1, 2023 · 5 comments
Closed
Assignees

Comments

@rly
Copy link
Collaborator

rly commented Sep 1, 2023

Describe the bug

dj.set_password runs the MySQL query SET PASSWORD = PASSWORD('new_password') (source code). This used to work, but I think the MySQL database was recently updated to version 8.0.34, and the PASSWORD function in MySQL has been removed in MySQL version 8.

I'll report this in DataJoint but want to log it here as it appears to be an incompatibility between the Frank Lab database MySQL version and the MySQL version expected by DataJoint.

Note that dj.set_password is also called in config/dj_config.py

New password: 
Confirm password: 
[2023-08-31 22:06:46,571][ERROR]: Uncaught exception
Traceback (most recent call last):
  File "/Users/rly/Documents/NWB/spyglass/config/dj_config.py", line 115, in <module>
    main(*sys.argv[1:])
  File "/Users/rly/Documents/NWB/spyglass/config/dj_config.py", line 109, in main
    set_configuration(config)
  File "/Users/rly/Documents/NWB/spyglass/config/dj_config.py", line 96, in set_configuration
    dj.set_password()  # set the users password
  File "/Users/rly/mambaforge/envs/spyglass/lib/python3.9/site-packages/datajoint/admin.py", line 19, in set_password
    connection.query("SET PASSWORD = PASSWORD('%s')" % new_password)
  File "/Users/rly/mambaforge/envs/spyglass/lib/python3.9/site-packages/datajoint/connection.py", line 340, in query
    self._execute_query(cursor, query, args, suppress_warnings)
  File "/Users/rly/mambaforge/envs/spyglass/lib/python3.9/site-packages/datajoint/connection.py", line 296, in _execute_query
    raise translate_query_error(err, query)
datajoint.errors.QuerySyntaxError: ("You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'PASSWORD('******')' at line 1", "SET PASSWORD = PASSWORD('******')")
@rly rly changed the title dj.set_password does not work dj.set_password does not work in Frank Lab production database (MySQL 8) Sep 1, 2023
Copy link
Contributor

lfrank commented Sep 1, 2023

My guess is that they are much more likely to get to this if it is a pull request, so I just wanted to note that in case someone has time to fork datajoint and change the query to (I believe)
ALTER USER user_name IDENTIFIED BY 'password';

@lfrank
Copy link
Contributor

lfrank commented Sep 1, 2023

@CBroz1 Your thoughts on how to fix this would be greatly appreciated; this seems like a high priority to me.

@CBroz1
Copy link
Member

CBroz1 commented Sep 2, 2023

The edits to DJ seem pretty straightforward, checking version before sending the command. I'll mention it in their slack to get it on their radar. I have a busy week ahead with the move, but I can tackle a PR thereafter if needed

@rly
Copy link
Collaborator Author

rly commented Sep 2, 2023

I took care of it in datajoint/datajoint-python#1106 . It was a fun little challenge to set up the tests right. Hopefully it is merged soon. In the meantime, we can run dj.conn().query("ALTER USER user_name IDENTIFIED BY 'password';")

@edeno
Copy link
Collaborator

edeno commented Sep 19, 2023

This has been merged into datajoint so I am closing. If this becomes an issue again, please reoopen.

@edeno edeno closed this as completed Sep 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants