The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Strange behavior of Mysql::adddb (XMLAPI php class)

Discussion in 'cPanel Developers' started by finitor, Oct 2, 2009.

  1. finitor

    finitor Registered

    Joined:
    Oct 2, 2009
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    1
    Firstly thanks for the useful XMLAPI class. I use it with no problem except the present issue.

    When i create a db using Mysql::adddb function via api1_query it can not be accessed by the root user until i login to Cpanel web interface and list the databases created.
    - I create the database as the root user of a reseller account.
    - I do not create any additional users to access the newly created db.
    - I can see the db listed when i query Mysql::listdbs
    - I can neither see the db listed in phpmyadmin interface nor access it with PHP's mysql functions(giving access denied error).
    - Querying Mysql::updateprivs does not help
    - Giving ALL permissions to root account(which must have them by default) on the database does not help

    The only thing to make it accessible, as mantioned above, is to visit the web interface(frontend/x3/sql/index.html) where the databases are listed. After then, i can see it in phpmyadmin interface or access it using PHP in order to create my tables.

    What is it the web interface is doing and API is missing?

    CPANEL: 11.24.5
    Mysql: 5
    CPanel API: 1
     
  2. finitor

    finitor Registered

    Joined:
    Oct 2, 2009
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    1
    FYI, here is the code:
    Code:
      $xmlapi = new CPXML('127.0.0.1');//renamed the class
      $xmlapi->set_port(2083);
      $xmlapi->password_auth(CP_USER, CP_PASS);
      $xmlapi->return_xml(1);
      return $xmlapi->api1_query(CP_USER, 'Mysql', 'adddb', array('mydbname'));
    Runs and creates the db with no problem.
     
  3. boteeka

    boteeka Registered

    Joined:
    Apr 8, 2010
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    1
    I have the exact same problem.

    cPanel 11.25.0-R45750 - WHM 11.25.0 - X 3.9
    CENTOS 5.5 x86_64 virtuozzo

    @finitor: If you've found a solution in the meantime would you mind sharing, please?
     
  4. finitor

    finitor Registered

    Joined:
    Oct 2, 2009
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    1
    It was fixed automatically when i upgraded to 11.25.
    I have no idea what caused the issue.

    Good luck.
     

Share This Page