dbmaptool: DB is already owned by USER
An account creates a MySQL db and user through the normal cPanel interface and they both show up in the cPanel interface.
Then the account deletes both of them and they are gone from the cPanel interface.
Then a command line tool attempts to create the same database and user. It's successful (they exist and can be accessed), but the database and user don't show up in the cPanel interface.
So I use dbmaptool as follows:
/usr/local/cpanel/bin/dbmaptool CPUSER --type mysql --dbusers DBUSERNAME
And that works, so now the username shows up in cPanel, so then I do this:
/usr/local/cpanel/bin/dbmaptool CPUSER --type mysql --dbs DBNAME
And it gives me the error "DBNAME is already owned by CPUSER" and it still doesn't show up in the cPanel interface.
It seems that either something is being left behind when a database is deleted from within the cPanel interface, or there is a bug in the dbmaptool that makes it think the database is still owned by an account.
I need to be able to recreate the database and map it to a user even if it previously existed.
Any thoughts?
-
Seems to have been fixed by also running /usr/local/cpanel/bin/dbindex 0 -
Then a command line tool attempts to create the same database and user. It's successful (they exist and can be accessed), but the database and user don't show up in the cPanel interface.
Hello, The user's JSON file is updated immediately, when the database is created or removed. However, the /var/cpanel/databases/dbindex.db.json file isn't updated in real time, instead it's updated by the following "root" cron job:15 */2 * * * /usr/local/cpanel/bin/dbindex >/dev/null 2>&1
Could you let us know the specific method you are using to create the database and database user through the command line? Thank you.0 -
Hello... WHM 60.0 (build 24) I also seem to have this issue, however I am not trying to recreate a database, I am trying to have another user/account owner it which seems to the the reason for the tool. "The Database Map Tool allows you to assign ownership of databases and database users to specific cPanel accounts." I go into WHM and into the Database Map Tool. I select the account to whom the database should be owned by. In the Database Name box I enter in the name of the database I want the selected account to own. "DATABASE is already owned by USERNAME" (Which is TRUE as that account is still active.) I did the same thing for users I wanted to move, and it did not actually MOVE them, it duplicated them into the new account. Per the tools description it should allow me to assign ownership. Please help. Side Note...The help doc on how to use it is incorrect. Look step #4 and #5, they are clearly wrong. 0 -
Same here... root@geekshack2 [/var/cpanel]# /usr/local/cpanel/bin/dbmaptool capilisco --type mysql --dbs newstrad_civicrm newstrad_civicrm is already owned by newstrad
Highly annoying as I need to delete the newstrad account and assign the database to another user0 -
Same here...
root@geekshack2 [/var/cpanel]# /usr/local/cpanel/bin/dbmaptool capilisco --type mysql --dbs newstrad_civicrm newstrad_civicrm is already owned by newstrad
Highly annoying as I need to delete the newstrad account and assign the database to another user
In my case, I CAN NOT remove the current user as it is still being used. I switched community software I used but wanted to keep the old site active so I could reference it if I needed to. So I made a new account for it and moved all the old site to it and just need to make the database be owned by the right account.0 -
Hello, The Database Map tool is intended to assign unaffiliated databases and database owners to existing cPanel accounts. It's not designed to transfer ownership of databases or database usernames from one cPanel account to another. A condition where the database index was not updated immediately after a database creation that allowed this behavior in the past was corrected in cPanel version 58: Fixed case CPANEL-6587: Update database index when creating a MySQL database. The recommended solution for transferring databases from one account to another is to backup the databases, remove them from an existing account, and then restore them to the new account. Or, to reduce downtime, backup the database, and upload it to the new account under a different database name. I've opened a case with our documentation team to ensure 0 -
Hi... Thank you kindly for the reply. Clearly, that is not what the tool states and thus, yes, should be updated to reflect the right information. The solution is not ideal as you are talking about large databases that would take a very, very long time to export and import. After all, the databases are just fine and just WHM needs to updated to know what account should have control over them. This does not sound like it should be an issue like this at all seeing if I were to remove the account, I could map the database to someone else. So why would you not be able to do so regardless? Is there no other way to map it to the right user? IE...Could you remove some files or something that is used to map them and then just remap them using the tool thus remaking the files? Thank you Michael. 0 -
Unfortunately, there are no custom workarounds to offer to make this tool transfer databases from one account to another. One alternate solution, if the size of the database is the drawback to manually moving the database, is to backup the destination account, terminate it, and then add it as an addon domain name to the account with the database you want to move. At that point, you could use the following option to convert the addon domain name to it's own account (with the database): Convert Addon Domain to Account - Documentation - cPanel Documentation You'd then only have to restore the aspects of the account that you terminated from the backup (website files, emails, etc), as opposed to the large database. I recommend opening a feature request if you'd like to see that functionality considered for a future version of cPanel: Submit A Feature Request Thank you. 0 -
Thanks...however I think I think that would also take the new database that was made for the conversion with it as it would also be assigned to the account. (Unless it allows for you to select databases to move with it.) And if you can, then surely it is possible to change the account a database belongs to. Thank you again Michael. 0 -
Augh...I tried to make the feature request and it allows me to start a new one, however when I go to submit, it asks me to login and it fails every time yet it allows me compose. From this thread discussion... dbmaptool: DB is already owned by USER There are times when you may need to change the account a databased is mapped to. The The Database Map Tool is worded that it should be able to do this...however it can not if the database is already mapped to an account. Real life need/example...I switched community software I used but wanted to keep the old site active so I could reference it if I needed to. (Vb to Xenfono) So I made a new account for it and moved all the old site to it and just need to make the database be owned by the right account. Also in doing this it would allow me to make one backup of the old site, which will not change as it is now more or less an archive, and not have to back up 12 gigs of data each night as then I can exclude it from the backup. 0 -
Thanks...however I think I think that would also take the new database that was made for the conversion with it as it would also be assigned to the account. (Unless it allows for you to select databases to move with it.) And if you can, then surely it is possible to change the account a database belongs to.
You can choose to "Move" or "Copy" any existing databases from the source account when using this feature.Augh...I tried to make the feature request and it allows me to start a new one, however when I go to submit, it asks me to login and it fails every time yet it allows me compose.
Could you click "Login", then choose the "Register" tab to see if that allows you to create a new account? Thank you.0 -
You can choose to "Move" or "Copy" any existing databases from the source account when using this feature. Could you click "Login", then choose the "Register" tab to see if that allows you to create a new account? Thank you.
Looks like it took my new registration even though it reads when you go to the link you provided... You've been automatically registered on the cPanel Feature Requests System! As a registered user of the cPanel Community Forums, you have been automatically logged into the cPanel Feature Requests System by visiting this page. You should not need to register on the cPanel Feature Requests site to contribute and get involved, we've taken care of that for you here. Your cPanel Community Forum login details are now tied to the Feature Requests site. You can use the link on top of any page of the forums to access the Feature Requests site directly from now on. Thank you visiting this page! If you're looking for an introduction to the new Feature Requests site, you'll find that below. ...So something is not right somewhere as it clearly did not work and allowed me to register with the same address. I did get the email and registered. I have now made the request which is in moderation.0 -
I have now made the request which is in moderation.
Hello, Thank you for taking the time to open a feature request. Feel free to post the link here once it's approved by one of the moderators for visibility to anyone visiting this thread for the first time. Our documentation team has completed the changes to the Database Map Tool document, and the changes are planned for publication in the near future. Thank you.0 -
Your welcome Michael. And Thank YOU for the support you all give. I will post the link once it is approved. (Hope I get a not on it or I surely will forget. :)) 0 -
Unfortunately, there are no custom workarounds to offer to make this tool transfer databases from one account to another. One alternate solution, if the size of the database is the drawback to manually moving the database, is to backup the destination account, terminate it, and then add it as an addon domain name to the account with the database you want to move. At that point, you could use the following option to convert the addon domain name to it's own account (with the database): Convert Addon Domain to Account - Documentation - cPanel Documentation You'd then only have to restore the aspects of the account that you terminated from the backup (website files, emails, etc), as opposed to the large database. I recommend opening a feature request if you'd like to see that functionality considered for a future version of cPanel: Submit A Feature Request Thank you.
Hi Michael... Well, this sounded like a good idea, however it requires me to take out another domain to do it. (Unless I can fake it somehow because it goes to look up the address to see if it is valid.) I tried using oldsite.currentdomain.com and it says I can not park it on top of itself. (That is what sub domains are for.) So do you know of a way I can fake it to I can make the add on domain and then do what we need to do to convert it to an account? I was trying to make a url like oldsite.domain.com using make new account (Thus really a sub domain but with a real account.) The reason, as I think I mentioned, was that then I did not need to back it up each night. Hope all that made sense. :)0 -
Hello @BottNet, You could temporarily enable the following options under the "Domains" tab in "WHM >> Tweak Settings": Allow Remote Domains Allow unregistered domains Thanks. 0 -
Feature Request Now Posted... Remap Database to another Account 0 -
Hello @BottNet, You could temporarily enable the following options under the "Domains" tab in "WHM >> Tweak Settings": Allow Remote Domains Allow unregistered domains Thanks.
Hi... Ok, I made a fake domain as an add-on. I then turned it into an account while taking the database with it. I then went into WHM and changed the domain name from the fake one to be the one I wanted so it would work. So...I did finely get it done. But it should would have been much easier if WHM could just change the owner. :) Thank you Michael for your help.0 -
I'm happy to see the workaround worked well. I also voted for the feature request, and encourage anyone else that wants the same feature after reviewing this thread to vote and add feedback to it. Thanks! 0
Please sign in to leave a comment.
Comments
19 comments