2

It's a long sentence, anyone knows?

skaffman
  • 398,947
  • 96
  • 818
  • 769
user198729
  • 61,774
  • 108
  • 250
  • 348

2 Answers2

3

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
  • 445,704
  • 82
  • 492
  • 529
1

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.

W3Schools

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
  • 5,039
  • 10
  • 44
  • 56