Perhaps the easiest way is with CREATE TABLE... SELECT. For example, if I have a database called "NYCNH" (by coincidence, I do!) which contains a table called "checks" and I want to copy that table to a database called "TEST" I could do this:

mysql> create table test.checks select * from nycnh.checks;
Query OK, 80030 rows affected (0.88 sec)
Records: 80030  Duplicates: 0  Warnings: 0

and that would create a copy of the structure and data from "checks" and put it in the database "test."

I believe this will not copy triggers or indexes from the original table. If you need to do this, you can do it by using the mysqldump program to dump the table (just the structure or the structure and data) from the original database and then load it into the new one: http://dev.mysql.com/doc/refman/5.0/en/mysqldump.html

Good luck!

Douglas Sims
[EMAIL PROTECTED]



On Jun 7, 2006, at 8:09 PM, murthy gandikota wrote:

How can I copy tables from one database to another on the same host?

  Thanks for your help
  Murthy

 __________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around
http://mail.yahoo.com


--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to