开发者

exporting table records as insert in mysql using mysql query browser?

how to export table records as insert in mysql using mysql query browser?

is there any other tool开发者_运维百科 that can do it?


You might use the mysqldump utility if you have access to it. An example might be

C:\mydir> mysqldump <database> -u<username> -p<password> -t -n -c <table>


The old school way is to use string concatenation:

SELECT CONCAT('INSERT INTO YOUR_TABLE (col1, col2) VALUES(', t.col1,',', t.col2, ')')
  FROM YOUR_TABLE t

Copy the output to a script. Mind that you'll have to handle data types appropriately (IE date/time).

But I have to wonder why you don't just use mysqldump, and get the INSERT statement out of the per table backup.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜