Skip to content

fix(core): remove duplicate MySQL user prefix#59514

Open
MichaIng wants to merge 1 commit intomasterfrom
fix/double-db-prefix
Open

fix(core): remove duplicate MySQL user prefix#59514
MichaIng wants to merge 1 commit intomasterfrom
fix/double-db-prefix

Conversation

@MichaIng
Copy link
Copy Markdown
Member

@MichaIng MichaIng commented Apr 8, 2026

  • Resolves: #

Summary

PR #53212 implemented a hardcoded database username, instead of deriving it from the Nextcloud admin username, to be able to setup Nextcloud without admin user.

However, it used oc_admin, while the MySQL database setup adds oc_ again in the dedicated createSpecificUser() function, resulting in oc_oc_admin. In case of PostgreSQL, this was done in setupDatabase(), replaced with the hardcoded username.

I kept the 16 characters limit, not sure whether this is still needed. The function is actually called only internally, only in this very script, so it should never see any other value than oc_admin. Let me know if I should remove the 0-16 substring, along with the confusing $adminUser variable (since this user is neither the database admin, nor the Nextcloud admin).

TODO

  • ...

Checklist

AI (if applicable)

  • The content of this PR was partly or fully generated using AI

@MichaIng MichaIng added this to the Nextcloud 34 milestone Apr 8, 2026
@MichaIng MichaIng requested a review from a team as a code owner April 8, 2026 19:13
@MichaIng MichaIng added bug 3. to review Waiting for reviews labels Apr 8, 2026
@MichaIng MichaIng requested review from ArtificialOwl, CarlSchwan, leftybournes and salmart-dev and removed request for a team April 8, 2026 19:13
@MichaIng MichaIng force-pushed the fix/double-db-prefix branch 2 times, most recently from a3e51f3 to 29fe029 Compare April 8, 2026 19:33
@MichaIng MichaIng force-pushed the fix/double-db-prefix branch from 29fe029 to 37f0f54 Compare April 8, 2026 19:39
PR #53212 implemented a hardcoded database username, instead of deriving it from the Nextcloud admin username, to be able to setup Nextcloud without admin user. This has the additional benefit that knowing one of them does not allow to derive the other.

However, it used `oc_admin`, while the MySQL database setup adds `oc_` again in the dedicated `createSpecificUser()` function, resulting in `oc_oc_admin`. In case of PostgreSQL, this was done in `setupDatabase()`, replaced with the hardcoded username.

Signed-off-by: MichaIng <micha@dietpi.com>
@MichaIng MichaIng force-pushed the fix/double-db-prefix branch from 37f0f54 to fd046ed Compare April 8, 2026 19:42
@github-actions
Copy link
Copy Markdown
Contributor

Hello there,
Thank you so much for taking the time and effort to create a pull request to our Nextcloud project.

We hope that the review process is going smooth and is helpful for you. We want to ensure your pull request is reviewed to your satisfaction. If you have a moment, our community management team would very much appreciate your feedback on your experience with this PR review process.

Your feedback is valuable to us as we continuously strive to improve our community developer experience. Please take a moment to complete our short survey by clicking on the following link: https://cloud.nextcloud.com/apps/forms/s/i9Ago4EQRZ7TWxjfmeEpPkf6

Thank you for contributing to Nextcloud and we hope to hear from you soon!

(If you believe you should not receive this message, you can add yourself to the blocklist.)

Copy link
Copy Markdown
Member

@joshtrichards joshtrichards left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one (among others) should already be addressed in #59094. Since I've been doing various refactoring in that area of code already, I'd obviously prefer to go that route... ;-)

@MichaIng
Copy link
Copy Markdown
Member Author

@joshtrichards Nope, your PR does not address this, it still adds oc_ to the name in createSpecificUser, while that is called with a hardcoded oc_admin input already. But your PR clarifies the 16 characters limit, and makes the fix easier. I'll do the suggestion there, but can also rebase after your PR has been merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants