Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

The Community Forums

Interact with an entire community of cPanel & WHM users!

SOLVED UAPI Add MySQL Host doesn't take effect

Discussion in 'cPanel Developers' started by CristianAugusto, Mar 20, 2019.

  1. CristianAugusto

    CristianAugusto Member

    Joined:
    May 22, 2011
    Messages:
    5
    Likes Received:
    1
    Trophy Points:
    51
    Hey Guys,

    I'm developing a basic PHP script to add new hosts to the MySQL external access using the function MySQL:add_host_note. The scripts works and if I run the MySQL::get_host_notes function, the hosts which was recently added are there.
    However there are two problems: if I check the hosts on cPanel page "/frontend/paper_lantern/sql/managehost.html", the hosts aren't there. And if I try a external connection to the MySQL server, it doesn't work.
    I have done a test: I added a host using the function and then I ran the function MySQL::get_host_notes: the host was there; however it wasn't on "/frontend/paper_lantern/sql/managehost.html" page. So I tried connect to the server using a external network: it didn't work. To check the problem, I added the host at the "/sql/managehost.html" page: the connection has worked.

    I could use the API2, but it doesn't support add notes to the host. So I would like to use the UAPI functions.
    I'm using a shared hosting with cPanel 76.0.20.

    Could you help me with this problem?

    Thank you!
     
  2. cPanelLauren

    cPanelLauren Forums Analyst II Staff Member

    Joined:
    Nov 14, 2017
    Messages:
    5,715
    Likes Received:
    436
    Trophy Points:
    233
    Location:
    Houston
    cPanel Access Level:
    DataCenter Provider
    Hi @CristianAugusto


    To clarify it seems like there may be two issues here

    1. Adding the remote host - can you detail how this is being done?

    2. When the remote host is added the add remote host note function isn't adding notes to all UI's?


    Thanks!
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  3. CristianAugusto

    CristianAugusto Member

    Joined:
    May 22, 2011
    Messages:
    5
    Likes Received:
    1
    Trophy Points:
    51
    Hi @cPanelLauren !

    Thank you for your reply.
    Sure, I'll clarify these two questions

    1 - I'm using a PHP script wich uses the CURL functions to create a cPanel Session. To add a host I access (using the CURL functions) the URL
    "
    Code:
    https://cpaneldomain:2083/execute/Mysql/add_host_note?host=HOSTHERE&note=NOTEHERE
    2 - Before adding a new host using the UAPI function "Mysql::add_host_note", the page "/frontend/paper_lantern/sql/managehost.html" is like this:


    Using the API Shell to run the UAPI function "Mysql::get_host_notes", the system returns this:


    So, when I run the PHP script to add a new host and use the API Shell again, the system returns this (with the new host inserted):


    But the page "/frontend/paper_lantern/sql/managehost.html" still shows the same hosts as before:

    - Please attach images to post. Links removed -

    Besides that, the external MySQL connection doesn't work with the host recently added, unless I insert the host at the last page showed.

    Thanks!
     
    #3 CristianAugusto, Mar 23, 2019
    Last edited by a moderator: Mar 23, 2019
  4. CristianAugusto

    CristianAugusto Member

    Joined:
    May 22, 2011
    Messages:
    5
    Likes Received:
    1
    Trophy Points:
    51
    Hi @cPanelLauren!

    Thank you for your reply.
    Sure, I'll clarify these two questions

    1 - I'm using a PHP script wich uses the CURL functions to create a cPanel Session. To add a host I access (using the CURL functions) the URL
    Code:
    https://cpaneldomain:2083/execute/Mysql/add_host_note?host=HOSTHERE&note=NOTEHERE
    2 - Before adding a new host using the UAPI function "Mysql::add_host_note", the page "/frontend/paper_lantern/sql/managehost.html" is like this:
    11.png

    Using the API Shell to run the UAPI function "Mysql::get_host_notes", the system returns this:
    21.png

    So, when I run the PHP script to add a new host and use the API Shell again, the system returns this (with the new host inserted):
    22.png

    But the page "/frontend/paper_lantern/sql/managehost.html" still shows the same hosts as before:
    12.png

    Besides that, the external MySQL connection doesn't work with the host recently added, unless I insert the host at the last page showed.

    Thanks!

    Moderator: please remove the previous post. Thanks
     
  5. CristianAugusto

    CristianAugusto Member

    Joined:
    May 22, 2011
    Messages:
    5
    Likes Received:
    1
    Trophy Points:
    51
    Hi guys,

    Problem solved. First you have to use the function "Mysql::add_host" to add the host and then "Mysql::add_host_note" to add the note to that host.
     
    cPanelLauren likes this.
Loading...

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice