Two functions manage MySQL/MariaDB: databasemysql for databases and usermysql for database users. Names are always prefixed with the account username and an underscore (john_shop).
Databases (databasemysql)
URL: https://YOUR-SERVER:2304/v1/databasemysql/ — permission MySQL Databases.
Create
Send the name without the prefix in database:
curl -k -X POST https://203.0.113.10:2304/v1/databasemysql/ -d "key=YOUR_API_KEY&action=add&user=john&database=shop"
{"status":"OK","msj":"Mysql database successfully created","dbsPack":"6/0"}
The database is created as john_shop. dbsPack shows the package limit and the previous count.
List
curl -k -X POST https://203.0.113.10:2304/v1/databasemysql/ -d "key=YOUR_API_KEY&action=list&user=john"
{"status":"OK","msj":[{"database":"john_shop","user":"","host":""}]}
Delete
Send the full name:
curl -k -X POST https://203.0.113.10:2304/v1/databasemysql/ -d "key=YOUR_API_KEY&action=del&user=john&database=john_shop"
{"status":"OK","msj":"Deleted john_shop database"}
susp / unsp temporarily block and restore access to a database.
Database users (usermysql)
URL: https://YOUR-SERVER:2304/v1/usermysql/ — permission MySQL Users.
Create a user and grant access
| Parameter | Description |
|---|---|
user | Hosting account username |
userdb | User name without the prefix, for example shop |
pass | Password |
dbase | Full database name to grant access to, for example john_shop |
host | localhost for websites on the server, % for any host, or an IP address |
curl -k -X POST https://203.0.113.10:2304/v1/usermysql/ \
-d "key=YOUR_API_KEY&action=add&user=john&userdb=shop&pass=S3cretPass&dbase=john_shop&host=localhost"
{"status":"OK","msj":{"database":"john_shop","userdb":"john_shop","host":"localhost","pass":"S3cretPass"}}
List
curl -k -X POST https://203.0.113.10:2304/v1/usermysql/ -d "key=YOUR_API_KEY&action=list&user=john"
{"status":"OK","msj":{"1":{"user":"john_shop","host":"localhost"}}}
Delete
curl -k -X POST https://203.0.113.10:2304/v1/usermysql/ -d "key=YOUR_API_KEY&action=del&user=john&userdb=john_shop&host=localhost"
{"status":"OK","msj":"Deleted john_shop User"}
action=udp changes a user’s password (userdb, host, pass).