mysqldump table without dumping the primary key

后端 未结 10 1470

I have one table spread across two servers running MySql 4. I need to merge these into one server for our test environment.

These tables literally have millions of r

10条回答
  •  孤独总比滥情好
    2020-12-24 02:00

    This is a total pain. I get around this issue by running something like

    sed -e "s/([0-9]*,/(/gi" export.sql > expor2.sql 
    

    on the dump to get rid of the primary keys and then

    sed -e "s/VALUES/(col1,col2,...etc.) VALUES/gi" LinxImport2.sql > LinxImport3.sql
    

    for all of the columns except for the primary key. Of course, you'll have to be careful that ([0-9]*, doesn't replace anything that you actually want.

    Hope that helps someone.

提交回复
热议问题