So I’ve managed to log in root and create a cpanel account for a new domain… and I’ve managed to create a database. However I must be missing a step since the only way to access the created database is to log in as root.
Is it possible to create it and assign it to the domain I’ve just created?
Here is what I’ve got:
/// this works, the domain account is created.
$result = $xmlapi->createacct($acct);
/*
I call the following function to create the database which remains owned by root. Although I want it owned by account we just created.
*/
// function generate database
//$master is root password. $c_user is the account name of the domain we just created.
function makedabase($c_user, $master){
//connect <--works
$link32 = mysql_connect('localhost', 'root', $master) or die(mysql_error());
//create
$dodb = mysql_query("create database {$c_user};",$link32) or die(mysql_error());
$wewe = mysql_select_db("{$c_user}", $link32);
echo 'Database has been created<br>';
sleep(3);
}
So am I doing something wrong? Or is what I’m trying to do just not possible?