Author Topic: mysql user add help  (Read 1039 times)

0 Members and 1 Guest are viewing this topic.

Offline
*
mysql user add help
« on: April 22, 2023, 12:22:42 PM »
I am adding user and database without any problem with the following codes

my question is what is the code that combines the user and database I added  :-\

veritabanı üzerinde işlem yapamadığım için izin istiyor




$data = array("key" => "MYKEY","action"=>'list',"user"=>'MYUSER');
$url = "https://IPSERVERAPI:2304/v1/databasemysql";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt ($ch, CURLOPT_POSTFIELDS, http_build_query($data));
curl_setopt ($ch, CURLOPT_POST, 1);
$response = curl_exec($ch);
curl_close($ch);



$data = array("key" => "MYKEY","action"=>'list',"user"=>'MYUSER');
$url = "https://IPSERVERAPI:2304/v1/usermysql";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt ($ch, CURLOPT_POSTFIELDS, http_build_query($data));
curl_setopt ($ch, CURLOPT_POST, 1);
$response = curl_exec($ch);
curl_close($ch);

Offline
*
Re: mysql user add help
« Reply #1 on: May 13, 2023, 04:17:23 PM »
As I understand you want to create a db_user, database and then add the created db_user to the database using API of CWP.

I looked at the CWP API, seems the action "add" of the API call "usermysql" creates the user and adds the db_user to the database because it has the param called "dbase" in description.

Let us know if it works :)