It's a long sentence, anyone knows?
views:
26answers:
2
+1
A:
Some thing like this:
SELECT *
INTO new_table_name [IN externaldatabase]
FROM old_tablename
WHERE 1=0
I'm not sure this works with My SQL but you get the idea.
This DOES NOT duplicate PK, FK, Indexes, Stored Procedures, or anything else. Just the columns and data types.
D'oh
I must have misunderstood your question. It is almost 3am way past bedtime.
Ok so there is probably a better way to do this, but this would get the job done.
SELECT CONCAT('INSERT INTO (COL1, COL2) VALUES (',COL1,COL2,');');
You will need to add ' for some data types so.
SELECT CONCAT('INSERT INTO (COL1, COL2) VALUES (',COL1,''' ''',COL2,');');
The take the output and run on the remote db.
NitroxDM
2010-04-25 08:33:58
The new_table is on another machine.So I think I have to do it in 2 steps.
2010-04-25 08:42:10
+3
A:
To create the dump
:
mysqldump --user [username] --password=[password] --no-create-info [database name] [table name] > /tmp/dump.sql
To restore:
mysql --u [username] --password=[password] [database name] [table name] < /tmp/dump.sql
codaddict
2010-04-25 08:43:20