• Dear Pleskians! The Plesk Forum will be undergoing scheduled maintenance on Monday, 7th of July, at 9:00 AM UTC. The expected maintenance window is 2 hours.
    Thank you in advance for your patience and understanding on the matter.

Question Create Database with PHP Script

Marcio Nunes

Basic Pleskian
Hi,
My customer need create database in PHP. He need many little databases dynamics

I created user in your subscription and set permission in mysql database table users to Create_priv (Y) and working, but, the database created dont show in plesk subscription.

How create a database and list in yours databases in Plesk. Missing a link to subscritor with table?

If dont show in Plesk, he dont can manager this databases, I dont share root passwords with customers
 
My test Work fine:
After create a database, I run this insert in data_base table (PSA database) (permission needed=priv_update)

INSERT INTO psa.`data_bases` (`id`, `name`, `type`, `dom_id`, `db_server_id`, `default_user_id`, `external_id`) VALUES (NULL, 'databasename', 'mysql', '1', '1', NULL, NULL)

Is ok? Is a risk of strucure Plesk?
 
In addition to the XML-RCP API suggested by Igor you can also use the REST API to create and manage databases. Which is a bit easier to work with. I any case, DO NOT directly edit the PSA database. It's a security risk and you may run into compatibility issues.
 
Back
Top