Hi, thanks for your help. I somehow figured it out.
A user registers with a php script. His data is stored in a "users_pending" DB.
With a bash script I export the DB.
#! /bin/bash
/opt/lampp/bin/mysqldump -u xxxx -pxxxxxxx
users_pending --tab=/home/edmundo/sqldump
Then a perl script creates the user DB, his rights, and some more functionality that I'm going to add.
#! /usr/bin/perl
open (DUMP,"users.txt");
while ($line = <DUMP>)
{
chop($line);
($u_id,$username,$password,$email,$active)=split (/\t/,$line);
open (MYSQLPIPE, "| /opt/lampp/bin/mysql -u xxx -pxxxxxxx");
{ print MYSQLPIPE ("CREATE DATABASE `$u_id`;");
print MYSQLPIPE ("GRANT SELECT,INSERT,UPDATE ON `$u_id`.* TO '$username'\@'%' IDENTIFIED BY PASSWORD '*$password';");
print MYSQLPIPE ("flush privileges;");
} close(MYSQLPIPE);
if(eof)
{ close(DUMP);
}
}
I plan to run these scripts as CRON jobs every hour.
There is still a lot to be done but this was a good start.
Thanks for the tips
Cheers
Vassilis