VestaCP api delete database
VestaCP api delete database
Hello guys.
I need, through an api, to create and delete mysql database.
From what I've been seeing in the documentation, it is possible to create a database via api as shown in the link https://vestacp.com/docs/api/#add_database
My question is whether it is possible to delete the mysql database through this same api. Would anyone know anything about that?
Thank you all
I need, through an api, to create and delete mysql database.
From what I've been seeing in the documentation, it is possible to create a database via api as shown in the link https://vestacp.com/docs/api/#add_database
My question is whether it is possible to delete the mysql database through this same api. Would anyone know anything about that?
Thank you all
-
- Support team
- Posts: 1111
- Joined: Tue Jul 30, 2013 10:18 pm
- Contact:
- Os: CentOS 6x
- Web: nginx + php-fpm
Re: VestaCP api delete database
Sure, this is possible. I think you can use this code:xinaidao wrote: ↑Wed Mar 17, 2021 12:20 amHello guys.
I need, through an api, to create and delete mysql database.
From what I've been seeing in the documentation, it is possible to create a database via api as shown in the link https://vestacp.com/docs/api/#add_database
My question is whether it is possible to delete the mysql database through this same api. Would anyone know anything about that?
Thank you all
Code: Select all
<?php
// Server credentials
$vst_hostname = 'server.vestacp.com';
$vst_username = 'admin';
$vst_password = 'p4ssw0rd';
$vst_returncode = 'yes';
$vst_command = 'v-delete-database';
$username = 'demo';
$db_name = 'demo_wordpress';
// Prepare POST query
$postvars = array[
'user' => $vst_username,
'password' => $vst_password,
'returncode' => $vst_returncode,
'cmd' => $vst_command,
'arg1' => $username,
'arg2' => $db_name
];
$postdata = http_build_query($postvars);
Also, see scripts in /usr/local/vesta/bin folder - you can use all those commands via API.
Re: VestaCP api delete database
Grayflolk,
thank you so much
thank you so much