Skip to main content

XML API 2. Bring the mysql db prefix

Comments

5 comments

  • cPanelMichael
    Hello, Each new database name or database username begins with the first eight characters of the account username and an underscore (_) when prefixing is enabled. Thus, if the username is abcdefghi, the prefix name is abcdefgh. Thank you.
    0
  • markskayff
    Thanks for your response. Yes, I was already assuming that. But it seems some cpanels have a custom prefix set for the db names that's even beyond the 8 chars. I'll see how can I deal with it then. Thanks for your answer.
    0
  • cPanelMichael
    Yes, I was already assuming that. But it seems some cpanels have a custom prefix set for the db names that's even beyond the 8 chars.

    This is unsupported, and should only happen if database prefixing is disabled and the user chooses to create a database name with an underscore. You may also want to consider disabling database prefixing completely by turning off "Require a username prefix on names of new databases and database users" in "WHM >> Tweak Settings" under the "SQL" tab. Thank you.
    0
  • markskayff
    Ok, I see. You can remove my previous comment. So is this something I can query through the API. I mean if the prefix setting is on or off?
    0
  • cPanelMichael
    So is this something I can query through the API. I mean if the prefix setting is on or off?

    Hello, Yes, you can use the following UAPI function for this purpose: UAPI Functions - Mysql::get_restrictions - Software Development Kit - cPanel Documentation View the "Prefix" row under the "Returns" section of this document for information on how to tell if prefixing is enabled. Thanks!
    0

Please sign in to leave a comment.