Skip to main content

Creating databases and users with uapi

Comments

4 comments

  • Miguel G
    Sorry, the editor put wrong the lines in my script
    /usr/bin/uapi --user=$CPUSER --output=json Mysql create_database name=$DATABASE /usr/bin/uapi --user=$CPUSER --output=json Mysql create_user name=$USERNAME password=$PASSWORD /usr/bin/uapi --user=$CPUSER Mysql set_privileges_on_database user=$USERNAME database=$DATABASE privileges=ALL PRIVILEGES
    BTW, I have WHM 60 build 25
    0
  • cPanelMichael
    Hello, I was able to reproduce this behavior, and it appears related to the URI encoded value for "ALL PRIVILEGES". When reproducing the error message using the example you provided, I notice through strace that it's sometimes attempting to run the command with the wrong syntax:
    703657 execve("/usr/bin/uapi", ["/usr/bin/uapi", "--user=user01", "Mysql", "set_privileges_on_database", "user=dbuser123", "database=1234", "privileges=ALL", "PRIVILEGES">, [/* 24 vars */]) = 0
    I updated the command to include "%20" instead of the space:
    /usr/bin/uapi --user=$CPUSER Mysql set_privileges_on_database user=$USERNAME database=$DATABASE privileges=ALL%20PRIVILEGES
    I could no longer reproduce the issue after making this change. Could you verify if that addresses the issue? If so, I'll open an internal case to ensure this is updated on our documentation. Thanks!
    0
  • Miguel G
    Yes, it works! Many thanks for looking into this!
    0
  • cPanelMichael
    Yes, it works! Many thanks for looking into this!

    I'm happy to see that helped. I opened a case with our Documentation Team to ensure the document is updated to further clarify the URI-encoded requirement. Thank you.
    0

Please sign in to leave a comment.