Re: How to dynamically create database and tables on mysql?
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 2011年10月21日 16:05, 王科选 wrote: Hi, Is there any way to dynamically create database and tables on mysql? For example, if I want to create 100 databases(dbname is unknown until run time), with 100 predefined tables in it, how to achieve that? Thanks in advance! do it in programme language or SQL procedure. - -- Best regards, Sharl.Jimh.Tsin (From China *Obviously Taiwan INCLUDED*) Using Gmail? Please read this important notice: http://www.fsf.org/campaigns/jstrap/gmail?10073. -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.11 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iQEcBAEBAgAGBQJOo82/AAoJEEYmNy4jisTjjIoH/R/BPe/skwMVoMmcAelJBQgD 8U1zDtcQu9O5JgQduci4OTodAUnYLYHbqzfqyQw1bom7gWK4Y+EigA9yzh2UENvi L/A5Gg5+bg+GD1LLpjUB0X6U44UzrFHKtOJsArGOou6bJ2n542ttN69RsbEQ7hVB HJenu7P32d6GNc41OjNNSwshoADmzdESG0/DzzrAbmSXRdQZBbrp5JxeiWNqytmX yqADFGbNxVKWn1ubBjNmIRpuMASf30qcxhChrl6Zj0LBt8w+173lKsK8OdqeyXFH O0Uzq4T3d4a2PtMyAiPyAxSJIoUN/djBruUKq/PLj/Sdtt60OBD5XdhMiMeeOHU= =pcDY -END PGP SIGNATURE- -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/mysql?unsub=arch...@jab.org
Re: How to dynamically create database and tables on mysql?
On 10/21/2011 3:05 AM, 王科选 wrote: Hi, Is there any way to dynamically create database and tables on mysql? For example, if I want to create 100 databases(dbname is unknown until run time), with 100 predefined tables in it, how to achieve that? Thanks in advance! Easiest mebbe from a scripting language like Perl or PHP, but you could also do it with PREPARE in a MySQL stored procedure. PB -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/mysql?unsub=arch...@jab.org
Re: How to dynamically create database and tables on mysql?
What is your application? Maybe we can help more. On 2011-10-21, at 2:05 AM, 王科选 wrote: Hi, Is there any way to dynamically create database and tables on mysql? For example, if I want to create 100 databases(dbname is unknown until run time), with 100 predefined tables in it, how to achieve that? Thanks in advance! -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/mysql?unsub=m...@renefournier.com -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/mysql?unsub=arch...@jab.org
Re: How to dynamically create database and tables on mysql?
Am 21.10.2011 10:05, schrieb 王科选: Hi, Is there any way to dynamically create database and tables on mysql? For example, if I want to create 100 databases(dbname is unknown until run time), with 100 predefined tables in it, how to achieve that? Thanks in advance! create database, drop database create table, drop table create table like. signature.asc Description: OpenPGP digital signature
Re: How to dynamically create database and tables on mysql?
- Original Message - From: Reindl Harald h.rei...@thelounge.net 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 -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/mysql?unsub=arch...@jab.org