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

Possibly dropping wrong database #212

Open
sniper7kills opened this issue Oct 14, 2020 · 3 comments · May be fixed by #267
Open

Possibly dropping wrong database #212

sniper7kills opened this issue Oct 14, 2020 · 3 comments · May be fixed by #267

Comments

@sniper7kills
Copy link
Contributor

$statements['delete-db'] = "DROP DATABASE `{$config['oldUsername']}`";

@ArlonAntonius Per our chat; we may be making an assumption about the database name.

Need to be investigated

@Tofandel
Copy link
Contributor

Tofandel commented Sep 2, 2022

And more than that, shouldn't the database only be renamed and not deleted and recreated? Otherwise all data is lost when you change a tenant's db username

It seems like if you change the username but not the database it will try to recreate an already existing db and fail there (in fact I have had the issue already)

@ArlonAntonius
Copy link
Member

@Tofandel As far as I'm aware there is no quicker way to rename databases that is supported in MySQL 5.7 and MySQL 8.

What we're doing now is:

  • Change Username
  • Change Password
  • Create Database
  • Grant Database Access to new User
  • Move tables one by one
  • Delete old database

If there is another way, I would love to know 😅 Might be something for a different issue though; would be a nice improvement to have.

@ArlonAntonius
Copy link
Member

To generally clarify this issue:

  • This is not an issue if developers are using the defaults function we provide in the Configuring event, as we are keeping the Username and Database in check
  • This is an issue if developers have custom logic that specifies the database name and it is not equal to the username

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants