• We value your experience with Plesk during 2024
    Plesk strives to perform even better in 2025. To help us improve further, please answer a few questions about your experience with Plesk Obsidian 2024.
    Please take this short survey:

    https://pt-research.typeform.com/to/AmZvSXkx
  • The Horde webmail has been deprecated. Its complete removal is scheduled for April 2025. For details and recommended actions, see the Feature and Deprecation Plan.
  • We’re working on enhancing the Monitoring feature in Plesk, and we could really use your expertise! If you’re open to sharing your experiences with server and website monitoring or providing feedback, we’d love to have a one-hour online meeting with you.

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