Closed ClaraCrazy closed 3 months ago
great... ofc localhost is a user on github. sorry for the mention, bud! fixed my comment accordingly
https://stackoverflow.com/questions/10169960/mysql-error-1449-the-user-specified-as-a-definer-does-not-exist wasn't helpful? A few people over there mention, that the run into that problem when moving from localhost to a remote db. I'm not aware where/if we are using triggers in Nextcloud.
I just cant understand why right now connects to a remote db server, and then queries it pretending to be localhost.
The error is a bit misleading I suppose, but it's from MySQL/MariaDB not us. My understanding is it's referring to the context that db server-side things are executed in (unlike other types of db authentication errors).
https://dev.mysql.com/doc/refman/8.4/en/stored-objects-security.html
https://stackoverflow.com/questions/3206820/change-the-stored-procedure-definer
I'm not aware of any (procedures, functions, triggers, and events) we use in core or shipped apps that would trigger (no pun intended) this problem. So it won't happen in a conventional installation AFAIK (I've never encountered it nor seen it come up). Maybe one of your installed apps, particularly third-party ones, has one or more { procedures, functions, triggers, and events } defined?
So pretty certain this isn't a bug on our side, but might be overlooking a spot.
A quick and dirty way to find the source would be to do a db dump then grep for DEFINER
. :-)
First of all, I apologize. This is NOT a nextcloud issue. I feel like an idiot now
Second, @joshtrichards you are correct. That lead me to line ~495k of the dump... how fun.
/*!50003 CREATE*/ /*!50017 DEFINER=`nextclouduser`@`localhost`*/ /*!50003 TRIGGER memories_fcu_trg
unsure how to edit this in the db right now, as im a bit stupid evidently, but I'll get there :)
Perhaps something to make sure others in the future wont get confused tho, slight clarification / different wording on that specific error?
I'll also close this for now. Should be fine
No worries!
I think this is pretty new. Landing in pulsejet/memories#1101 from the looks of it.
Memories is a popular app so it's good to know this may crop up.
For all people that have this, or similar, happen in the future:
mysqldump -u username -p --routines --add-drop-trigger --no-create-info --no-data --no-create-db --skip-opt database_name > outputfile.sql
then go edit the (very small, only containing triggers) resulting sql dump, and re-import again with
mysql -u username -p database_name < outputfile.sql
:heart:
⚠️ This issue respects the following points: ⚠️
Bug description
After some infrastructure changes, our SQL server is now finally seperate. Issues started to show up right away with nextcloud unfortuantely.
As can be seen in the image, nextcloud still tries to query via @'localhost' on the remote server. I'm puzzled by that. Simply creating an @'localhost' user on the SQL server fixed it, but uh... why? On remote DB solutions it (imo) should be expected that permissions are set to a single user@host, i.e. 'nextclouduser'@'1.1.1.1', as was the case here. The DB access is expected to come from, and identify as, the correct machine, so the fact it picks localhost broke quite a few things at first.
I just cant understand why right now connects to a remote db server, and then queries it pretending to be localhost. Not only is this very questionable, but this would mean I'd either have to know, and prepare a user with @'localhost', or do the worst and grant to @'%', which god forbid anyone actually does.
Steps to reproduce
Expected behavior
nextcloud should use fqdn (or have a config option) for this, so sql commands work fine, without needing another localhost user on the DB server.
Installation method
Community Web installer on a VPS or web space
Nextcloud Server version
28
Operating system
Debian/Ubuntu
PHP engine version
PHP 8.1
Web server
Apache (supported)
Database engine version
MariaDB
Is this bug present after an update or on a fresh install?
None
Are you using the Nextcloud Server Encryption module?
Encryption is Enabled
What user-backends are you using?
Configuration report
List of activated Apps
Nextcloud Signing status
Nextcloud Logs
Additional info
No response