Skip to main content

db user missing from Privileges column

Comments

12 comments

  • cPanelMichael
    Hello :) You may find the database mapping tool helpful: /usr/local/cpanel/bin/dbmaptool user1 --mysql --dbs 'db1'--dbusers 'virt1'
    Thank you.
    0
  • cPanelMichael
    Are there cPanel command line ways to create DBs and DBUsers, that doesn't create "serious misconfiguration" as per cPanelDavidN indicated?

    You can utilize the following document:
    0
  • Michael-Inet
    Unfortunately that document has errors and it's examples don't run. An example script ships with cPanel & WHM in the /usr/local/cpanel/base/frontend/x3/test.live.php file.
    Same results running as root or account owner.
    # php -f /usr/local/cpanel/base/frontend/x3/test.live.php
    Fatal error: Uncaught exception 'RuntimeException' with message 'There was a problem fetching the env variablecontaining the path to the socket' in /usr/local/cpanel/php/cpanel.php:146
    Stack trace:
    #0 /usr/local/cpanel/base/frontend/x3/test.live.php(8): CPANEL->__construct()
    #1 {main}
      thrown in /usr/local/cpanel/php/cpanel.php on line 146
    

    Save files to the /usr/local/base/frontend/theme/ directory, where theme is the cPanel theme, or create a symlink to the appropriate files.

    #ll /usr/local/base/frontend ls: cannot access /usr/local/base/frontend: No such file or directory
    Taking the correct path to be /usr/local/cpanel/base/frontend, and assuming we're talking about the WHM theme, I have no theme "x" to use. Brand new build, less than a week old, CENTOS 6.7 x86_64 standard " srv07 WHM 11.50.0 (build 30): WHM " Home " Themes " Change WHM Theme
    Currently selected theme: x Only one theme (x) is installed.
    I'd guess that's suppose to be x3, but usr/local/cpanel/base/frontend/x3/test.live.php failed, so no? # # # What exactly does one need to do to get the usr/local/cpanel/base/frontend/x3/test.live.php test file to run? Which user(s) are acceptable to run it? What ENV does it need? What $PATH is required? Anything else? Thanks, Michael Edit #1 Personally I'd just rather have the 3 variations of /usr/local/cpanel/bin/dbmaptool needed to do this, do they exist? Edit #2 cat /usr/local/cpanel/bin/dbmaptool
    sub usage { print "$0 cpuser --type mysql|pg --dbusers 'user1, user2' --dbs 'db1, db2'\n 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.'\n";
    > This tool will not map a virtual user to a database. Okay, so this didn't provide the 4th command, GRANT ALL PRIVILEGES like I thought.
    0
  • Michael-Inet
    Hi Michael, Trying to weed out the extraneous issues :) Past history indicates we're both bad about going off on tangents. # # # Goal is for a non-destructive cPanel command line method for: 1) Drop and Create DATABASE 2) Drop and Create DATABASE-USER 3) GRANT ALL PRIVILEGES on DATABASE to DATABASE-USER 4) Map DATABASE and DATABASE-USER to CPANEL-USER If using the raw mysql commands, as you indicated Adam could do, doesn't create "serious misconfiguration," then is it acceptable to use the raw commands I posted above and afterword, if I use dbmaptool, will dbmaptool do ALL of the internal cPanel needed configuration(s) that the UI normally handles? Being that the "serious misconfiguration" statement is 5 years old, is it valid anymore beyond needing to map something to a cpanel user? Apologies for not asking it this way the first time. Best, Michael
    0
  • Michael-Inet
    PS: Your signature link to Migration Services no longer works.
    0
  • Adam Fortman
    Thank you all for the input! I've tried the dbmap tool a few times, but the "Privileged Users" field is still blank, and it typically tells me that the cPanel user already owns that database. I'm guessing there are some other files that get updated when you grant privileges via the GUI. I will definitely be checking out that Guide to UAPI, thank you cPanelMichael!
    0
  • cPanelMichael
    Are there cPanel command line ways to create DBs and DBUsers, that doesn't create "serious misconfiguration" as per cPanelDavidN indicated?

    I'm not sure I understand your previous response about the UAPI functions. For instance, you can try using the Perl example found at:
    0
  • Michael-Inet
    Unfortunately that document has errors and it's examples don't run.

    0
  • cPanelMichael
    Please feel free to open a support ticket 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
  • Michael-Inet
    Support Request Id 7167791
    0
  • cPanelMichael
    Hello :) Here are some paraphrases referenced in the support ticket: 1. There are no current command line methods of setting database user privileges within our software. The database mapping tool does not pull any privileges information from the MySQL server. It simply adds databases and database users to a cPanel account. 2. You can not use the LiveAPI via the command line as mentioned in this thread: https://forums.cpanel.net/threads/liveapi-connections-to-cpsrvd-are-failing.281792 3. Some of the UAPI functions you were attempting to use are only available in cPanel version 11.52. It's currently only available in the "Current" and "Edge" build tiers. Feel free to update this thread with any additional findings with your custom script now that the support ticket is closed. Thank you.
    0

Please sign in to leave a comment.