Using cpanel, I was able to create a FTP user with limited access to allow our technical support team to upload files to the server.
Now, I'm kind of stuck since they also need to be able run script to create and populate databases each time we want to create a new subdomain, but it seems that we can only create databases via the cpanel.
Is there a way to remotely create databases (and grant all the access rights owned by that user to the database)?
Note: I'm hosting my project on HostGator (https://www.hostgator.com/)
Note: You'll need to ask your host for an SSH access and a root access to the database to apply the following solution.
Note 2: Replace "gemhr" in the following tutorial by your own domain.
Add full right the the database starting by "gemhr_" (use your domain name here) to the installer account:
Give the right to execute stored procedure on the table "mysql" to the installer account:
The following stored procedure must be ran after creating or deleting a database. It will grant or revoke the access to the account used in PHPMyAdmin and to the support account use by the server code (like PHP).
Change the "gemhr" for your domain name and change the access rights of "gemhr_support" based on what you need it to do in your server code.
To be on the safe side, you should also grant access to all your sub-domain database remotely and for localhost.
Use this command to open the crontab editor:
Use this command to refresh the database mapping once per hour:
CTRL + X to save.
Log in MySQL workbench with your installer to test that everything is alright:
Here's the expected result (you might want to set your cron job every minute for testing to quickly see the result in cpanel):
From there, I suggest to create some coding to completely hide the SQL creation to your tech. team behind a nice web interface.
Use that coding if you ever want to revert the changes presented in this post: