On Mon, 18 Feb 2002, Rick Emery wrote:
> CREATE TABLE newtable SELECT * FROM oldtable LIMIT 0;
Will that create indexes in newtable that were in oldtable? Also, you'd
have to do that for each table.
Depending on exactly what you want to do, another option would be to use
mysqldump -d old_db > createdefs.sql
to spit out the create table statements for the tables in old_db. Then
you could run
mysql new_db < createdefs.sql
to set up identical but empty tables in new_db. You could even save a
step with a pipe:
mysqldump -d old_db | mysql new_db
Michael Stassen
University Information Technology Services
Indiana University Bloomington
[EMAIL PROTECTED]
>
> -----Original Message-----
> From: Todd Ellner [mailto:[EMAIL PROTECTED]]
> Sent: Monday, February 18, 2002 12:58 PM
> To: [EMAIL PROTECTED]
> Subject: sql: Copying the structure of DBs
>
>
> I need to create multiple databases from time to time. This isn't a problem.
> The thing that seems tricky is creating databases with the same table names
> and structures, but none of the data, of old ones. I thought chapter 4 of
> the documentation covered this, but it doesn't quite seem to. Any
> suggestions? Is there a quick way to do this in MySQL? Or will I have to do
> something kludgy like parsing the output of a mysql "DESCRIBE" statement and
> making a create statement out of it?
>
> Todd
---------------------------------------------------------------------
Before posting, please check:
http://www.mysql.com/manual.php (the manual)
http://lists.mysql.com/ (the list archive)
To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php