Hi,
I am trying to create a MySQL database and set a current database user to the database.
The PHP code is written as below;
$site = "http://[cpanel_user]:[cpanel_password]@localhost:2082/execute/Mysql/";
$result = file_get_contents("{$site}create_database?name=zubair_test");
$result .= file_get_contents("{$site}set_privileges_on_database?user=zubair_admin&database=zubair_test&privileges=ALL%20PRIVILEGES");
print $result;
Now the database is being created fine with no errors, and it is mapped to the correct CPANEL user.
The issue I am having is setting a current database user to the newly created database. I am receiving the following error response.
{"errors":["(XID kamdnm) Database Error: There is no such grant defined for user 'zubair_admin' on host 'localhost'"],"status":0,"data":null,"messages":null,"metadata":{}}
Am I handling this the correct way to add a user to the newly created database? Perhaps could be a permissions issue with the current connection to MySQL? (The database user 'zubair_admin' I am trying to set to the database is the user I am connecting with).
Any advice or solutions will be much appreciated.
Thanks,
Zubair.
I am trying to create a MySQL database and set a current database user to the database.
The PHP code is written as below;
$site = "http://[cpanel_user]:[cpanel_password]@localhost:2082/execute/Mysql/";
$result = file_get_contents("{$site}create_database?name=zubair_test");
$result .= file_get_contents("{$site}set_privileges_on_database?user=zubair_admin&database=zubair_test&privileges=ALL%20PRIVILEGES");
print $result;
Now the database is being created fine with no errors, and it is mapped to the correct CPANEL user.
The issue I am having is setting a current database user to the newly created database. I am receiving the following error response.
{"errors":["(XID kamdnm) Database Error: There is no such grant defined for user 'zubair_admin' on host 'localhost'"],"status":0,"data":null,"messages":null,"metadata":{}}
Am I handling this the correct way to add a user to the newly created database? Perhaps could be a permissions issue with the current connection to MySQL? (The database user 'zubair_admin' I am trying to set to the database is the user I am connecting with).
Any advice or solutions will be much appreciated.
Thanks,
Zubair.