Create MySQL user and database via PHP

1

1 - Is it possible to create new MySQL user and database via PHP script?

2 - If so, would it involve any such security risk?

Objective: I have a system running (CMS itself) where the user does almost everything to activate on the server, being that, this will be allocated in a subdomain on our server, therefore, creating a database for this new user for this new subdomain would need to be automated at the time of registration, which today does not occur and every time we have to create new user and database for a new registration. I accept suggestions if they have other ways.

Details: VPS running Linux / WHM (11.52.0) / cPanel (11.52.0.15) / MySQL (5.6.23) / PHP (5.5)

    
asked by anonymous 18.10.2015 / 12:19

1 answer

2

1 - If the user that the php script runs has "GRANT OPTION", it can create other users and give permissions, from nothing to its equivalent permission.

2 - As they say, the current is strong as well as the weakest link, it depends on how your php is mounted. Other than that all is perfectly possible the way you intend.

    
23.10.2015 / 15:01