List:General Discussion« Previous MessageNext Message »
From:Johan De Meersman Date:October 21 2011 8:46am
Subject:Re: How to dynamically create database and tables on mysql?
View as plain text  
----- Original Message -----
> From: "Reindl Harald" <h.reindl@stripped>
> 
> create database, drop database
> create table, drop table
> create table like.....

I suspect the table names and structures are going to be identical each time - I'm
thinking automated blog deployment or something.

Prepare by creating a database (say, template) manually and setting it exactly as it
should be. Then, dump it so:
# mysqldump --opt --routines --triggers --hex-blob template | bzip2 > template.sql

Now you have a databaseless dump. Whenever you want to create a new database, you simply
enter mysql:
mysql> create database newsite;
mysql> use newsite
mysql> source /path/to/template.sql





-- 
Bier met grenadyn
Is als mosterd by den wyn
Sy die't drinkt, is eene kwezel
Hy die't drinkt, is ras een ezel
Thread
How to dynamically create database and tables on mysql?王科选21 Oct
  • Re: How to dynamically create database and tables on mysql?Reindl Harald21 Oct
    • Re: How to dynamically create database and tables on mysql?Johan De Meersman21 Oct
  • Re: How to dynamically create database and tables on mysql?Peter Brawley22 Oct
  • Re: How to dynamically create database and tables on mysql?René Fournier22 Oct
  • Re: How to dynamically create database and tables on mysql?Sharl.Jimh.Tsin23 Oct