Page 1 of 1

auto db creation script?

Posted: Fri Apr 28, 2017 2:11 am
by viraladmin
So I was looking at viewtopic.php?t=12221 and saw the following suggestion for manually adding databases created outside of vestacp to users inside vestacp:

Code: Select all

DB='admin_ru' DBUSER='admin_ru' MD5='*6856731FA3B869EC57DD182553B62343AEC3AE55E' HOST='localhost' TYPE='mysql' CHARSET='UTF8' U_DISK='1' SUSPENDED='no' TIME='12:13:55' DATE='2015-10-23'
DB='admin_test' DBUSER='admin_test' MD5='*DCFCFC391AC17E17A2F4A95EB13DB49E7A82FA4' HOST='localhost' TYPE='mysql' CHARSET='UTF8' U_DISK='1' SUSPENDED='no' TIME='00:02:26' DATE='2015-11-29'
I was wondering if it would be possible for someone (way outside my ability) to write a script that would do a root connection to the database, check all database names, and generate a series of database files based on user name matching.

Basically my thought is, root should be able to scan all databases. The for example if a database starts with admin_ add that to the admin database file and get the user and md5 for the user on that database. I would assume the date and time could use the current data and time from server.

Would something like this be possible? It would be very handy at importing an sqldump file into user accounts (and yes I am aware that would mean the users must first be created)