简体   繁体   English

Mysqldump更新表

[英]Mysqldump update table

I use the mysqldump utility to dump the database on the test server, which runs on the crown. 我使用mysqldump实用程序将数据库转储到测试服务器上,该服务器在表冠上运行。

Mysqldump --host = 127.0.0.1 --skip-add-drop-table --skip-add-locks --no-create-info --user = root --password = 'root' stead> tead.sql Mysqldump --host = 127.0.0.1 --skip-add-drop-table --skip-add-locks --no-create-info --user = root --password ='root'stead> tead.sql

On production for import use: 关于进口生产:

Mysql --user = root --password = 'root' test Mysql --user = root --password ='root'测试

It also starts on the crown. 它也从冠冕开始。

The dump file contains approximately the following information. 转储文件包含大致以下信息。

INSERT INTO im_gruppy VALUES (100, 'Paper for office equipment', 1, '100.png', 1); INSERT INTO im_gruppy VALUES(100,'办公设备用纸',1,'100.png',1);

The problem is that when insert finds Duplicate entry '1' for key 'PRIMARY', import stops. 问题是当insert为键'PRIMARY'找到Duplicate entry'1'时,导入停止。 And I would like to update the old records. 我想更新旧记录。

Prompt as it is possible by means of mysqldump and mysql to do update lines and if a line is not present that insert? 通过mysqldump和mysql可以提示更新行,如果不存在插入的行?

mysqldump --host = 127.0.0.1 --skip-add-drop-table --skip-add-locks --no-create-info --replace --user = root --password ='root'stead> tead。 SQL

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM