Skip to main content

How to repopulate database username.yaml

Comments

6 comments

  • cPanelMichael
    Hello :) You can use "/usr/local/cpanel/bin/dbmaptool" to update ownership of databases to specific accounts:
    -bash-4.1# /usr/local/cpanel/bin/dbmaptool /usr/local/cpanel/bin/dbmaptool cpuser --type mysql|pg --dbusers 'user1, user2' --dbs 'db1, db2' These flags are treated individually. This tool will not map a virtual user to a database. /usr/local/cpanel/bin/dbmaptool user1 --type mysql --dbs 'db1' --dbusers 'virt1' /usr/local/cpanel/bin/dbmaptool user1 --type mysql --dbs 'db1' && /usr/local/cpanel/bin/dbmaptool user1 --type mysql --dbusers 'virt1' The above two commands are analogous; result in cpuser 'user1' having privileges for 'db1' and having a virtual user named 'virt1.'
    The YAML file should create automatically when you create a database or database user. Thank you.
    0
  • Mic1
    Thank you for your reply. I'm feeling a bit short-handed with this solution. No databases/users will show up in cPanel. In order to properly fix this situation, I have to dig through mysql grants to find what user is assigned to what database, set them back up with the dbmaptool, and then use the cPanel api to re-add the user to the database. This is a very slow process when there are tens or hundreds of users to put back together again. Is there no other, more complete solution?
    0
  • cPanelMichael
    ] This is a very slow process when there are tens or hundreds of users to put back together again. Is there no other, more complete solution?

    Could you elaborate on how the databases/database users were removed from the account? It might be better to address the source of the problem as opposed to trying to manually resolve the issue for each account. Thank you.
    0
  • Mic1
    At this point the source of the problem is unknown. There are no related errors. All the users/databases were added to cPanel using the API and, shortly after the upgrade to 11.44, they've just gone missing, with no rhyme or reason.
    0
  • cPanelMichael
    ]At this point the source of the problem is unknown. There are no related errors. All the users/databases were added to cPanel using the API and, shortly after the upgrade to 11.44, they've just gone missing, with no rhyme or reason.

    Could you open a support ticket using the link in my signature so we can take a closer look? You can post the ticket number here so we can update this thread with the outcome. Thank you.
    0
  • Mic1
    An in-house tool is being created to fix these. This tool is also important since, in addition to the above, I need to be able to migrate accounts, which involves some things that won't work with an API in every instance. Thank you for your time and help, Michael. It's much appreciated.
    0

Please sign in to leave a comment.