-
-
Notifications
You must be signed in to change notification settings - Fork 459
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
Database creation not working #1316
Comments
seems to be a "mysql" related issue. MariaDB works just fine. I'm already on it. |
Can you verify whether the "global mysql" user for that customer exists? It should have the name of the customer's loginname. |
it is a local database. we have only one database. |
it usually gets created automatically on customer creation if the customer has mysql-resources. If I remember correctly there is no action yet for existing users, so this might be the issue, possibly try this: diff --git a/lib/Froxlor/Database/Manager/DbManagerMySQL.php b/lib/Froxlor/Database/Manager/DbManagerMySQL.php
index 1cf3f61c..61cb90f1 100644
--- a/lib/Froxlor/Database/Manager/DbManagerMySQL.php
+++ b/lib/Froxlor/Database/Manager/DbManagerMySQL.php
@@ -361,12 +361,15 @@ class DbManagerMySQL
*/
public function grantCreateToDb(string $username, string $database, string $access_host)
{
- $stmt = Database::prepare("
- GRANT ALL ON `" . $database . "`.* TO :username@:host
- ");
- Database::pexecute($stmt, [
- "username" => $username,
- "host" => $access_host
- ]);
+ // only grant permission if the user exists
+ if ($this->userExistsOnHost($username, $access_host)) {
+ $stmt = Database::prepare("
+ GRANT ALL ON `" . $database . "`.* TO :username@:host
+ ");
+ Database::pexecute($stmt, [
+ "username" => $username,
+ "host" => $access_host
+ ]);
+ }
}
} |
I will try it. By the way i did checked the upgrade script, and it fealt like it has some user creation or upgrade in it. Do you think if you release a new version it will include the global user creation? |
Yeah the update only handled existing global-users to correct some issues with permissions, looks like we should add an option to "Create global mysql for existing customers" in the next update, I agree |
by the way i tried your suggested patch, and it is working as well. thanks for the quick response! |
As a rule of thumb: before reporting an issue
Describe the bug
Database creation is not working
Following error happens:
A database error occurred
SQLSTATE[42000]: Syntax error or access violation: 1410 You are not allowed to create a user with GRANT
System information
To Reproduce
Steps to reproduce the behavior:
we use prefixes, and customer can enter any db name
Expected behavior
It should create a db
The text was updated successfully, but these errors were encountered: