Skip to main content

Mysql database creation

Comments

10 comments

  • cPanelMichael
    Hello, Database creation for cPanel users via the command line is supported with cPanel UAPI functionality:
    0
  • manish294
    Hi cPanelMichael, Thank you for the details and it worked :) But only one problem, if cpanel user logged in to shell uapi command is not working for them. Its running only from root. I have shared server so I can only give access of Jailed Shell or normal shell to users. Is there no way to create database from mysql prompt from user shell login ?(not from root) Thanks in advance :)
    0
  • cPanelMichael
    But only one problem, if cpanel user logged in to shell uapi command is not working for them. Its running only from root.

    Hello, Ensure you use the following command while logged in as the account username via SSH:
    uapi Mysql create_database name=database_name
    The "--user=username" parameter isn't required if you are already logged in as the account username. Thank you.
    0
  • manish294
    Hello cPanelMichael, Thank you. I have tried the provided command but received below errors: ================ -jailshell: uapi: command not found ================ When I assigned normal shell to user its showing below error ================ -bash: uapi: command not found ================ Even I tried to run /usr/bin/uapi from user shell and its not working. I am sure if uapi command runs in user shell the provided command by you will work. Any help regarding running uapi command from user shell would be great full. Thanks again :)
    0
  • cPanelMichael
    cPanel & WHM introduced the UAPI command line feature in version 56. Could you verify if this system uses cPanel version 56 or newer?
    cat /usr/local/cpanel/version
    Thank you.
    0
  • manish294
    Hi cPanelMichael, Yes, I have latest version of cpanel installed on the server. ======================== root@[~]# cat /usr/local/cpanel/version 11.58.0.26 ========================
    0
  • cPanelMichael
    Could you open a support ticket using the link in my signature so we can determine why UAPI isn't working via the command line? You can post the ticket number here so we can update this thread with the outcome. Thank you.
    0
  • manish294
    Hi cPanelMichael, I will open a support ticket soon and update this thread.
    0
  • manish294
    Hi cPanelMichael, I have an update. Before opening a support ticket I investigated further and noticed that uapi was not working because of cagefs. I have cloudlinux on my server and cagefs was enabled for user. Due to which uapi command was not working. It's working when I disabled the cagefs for user and yes it's creating database through the command you gave me :) Thank you again :)
    0
  • Bazinga
    Hi cPanelMichael, I have an update. Before opening a support ticket I investigated further and noticed that uapi was not working because of cagefs. I have cloudlinux on my server and cagefs was enabled for user. Due to which uapi command was not working. It's working when I disabled the cagefs for user and yes it's creating database through the command you gave me :) Thank you again :)

    there is a way to fix it: - install cagefs and PHP-Selector (if not yet installed) - change php version for all native version back to 5.3 with command: selectorctl --change-to-version=5.3 --version=native
    0

Please sign in to leave a comment.