Is there any way to create multiple databases in a single line of a query?
Something like this:
$sql="CREATE DATABASE `db1` AND/,/./etc `db2` AND/,/./etc `db3`";
$mysql_query=($sql,$con);
Other options would be to create a SQL file such as:
/*myFile.sql*/
CREATE DATABASE db1;
CREATE DATABASE db2;
Then run:
mysql -u user -p < myFile.sql
If you absolutely have to have it on a single console line you could do:
mysql -u user -p -e "CREATE DATABASE db3; CREATE DATABASE db4; ..."
I am not sure, but it should work only separated by semicolon ; You could try
mysqli_multi_query
but you have to been connected to database with mysqli_connect not mysql_connect :(
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With