Which script allows remote MySQL access?

SoftDux

Well-Known Member
May 27, 2006
1,023
5
168
Johannesburg, South Africa
cPanel Access Level
Root Administrator
Hi,

Can someone please tell me which script is used to allow remote MySQL access? i.e. in cPanel, when a client adds his IP address to the Remote MySQL list, what script is used in CentOS to add the IP to the database tables?

I am asking, since we use ConfigServerFirewall, and I want to automatically allow that IP address through the firewall with port 3306.


To explain what I am looking for, cPanel has a prewwwacct script which can be customized to run other scripts upon creation of a new account. I am looking for the same script for MySQL Remote Access
 

cPanelLauren

Product Owner II
Staff member
Nov 14, 2017
13,266
1,304
363
Houston

SoftDux

Well-Known Member
May 27, 2006
1,023
5
168
Johannesburg, South Africa
cPanel Access Level
Root Administrator

cPanelLauren

Product Owner II
Staff member
Nov 14, 2017
13,266
1,304
363
Houston

SoftDux

Well-Known Member
May 27, 2006
1,023
5
168
Johannesburg, South Africa
cPanel Access Level
Root Administrator
Hi @SoftDux

a collection of API calls including this one are run when you do this from the UI. I can't tell you the specific actions taken beyond running this as they're compiled in a perl module. If you're using a 3rd party script you might be able to create a standardized hook for this action: Guide to Standardized Hooks - Hookable Events - Developer Documentation - cPanel Documentation
I am not using a 3rd party script. I merely want to add the IP address into the firewall, as soon as the user adds the IP address in cPanel.
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,880
2,267
463
Hello @SoftDux,

You would have to develop a custom script that parses the IP addresses from the output of the Mysql get_host_notes UAPI function and adds them to the CSF whitelist. Then, setup your custom script to run during the post event stage of the Mysql::add_host UAPI function so that your custom script runs anytime someone authorizes a new host to the Remote MySQL option in cPanel. You can read more about setting up standardized hooks on the document below:

Guide to Standardized Hooks - Hookable Events - Developer Documentation - cPanel Documentation

If you need help developing the custom script, we provide a list of companies offering system administration services on the link below:

Guide to Standardized Hooks - Hookable Events - Developer Documentation - cPanel Documentation

Thank you.