in reply to Re^3: How to query mysql database schema with DBI
in thread How to query mysql database schema with DBI

My preferred method of creating tables is to put the create statement in a text file with a meaningful name, such as mytable_schema_2004_10_04.sql

Then from the unix command line you can just:

cat mytable_schema.sql |mysql -u [user] -p
This way, you have a copy of the original schema.

If it doesnt create correctly, you can modify the file easily enough to fix the problem.

If you ever make changes with ALTER, the original schema is still available.

Also, if you ever want to make an identical table, you already have the schema, or if you want to make a similar table, you can modify a copy of this file.

Yeah, in a lot of ways its like doing it from a script that you can run over and over, but doing it from a script is more complicated and less portable.