how to skip duplicate records when importing in phpmyadmin(在phpmyadmin中导入时如何跳过重复记录)
问题描述
我的本地机器上有一个数据库,我想将数据导入我的主机上的数据库.两个数据库是相同的,相同的表名、列名等
I have a db on my local machine and I want to import the data to the db on my hosting. Both db's are identical, the same table names, column names, etc.
当我通过 phpmyadmin 从我的本地数据库export 并import 它通过我主机上的 phpmyadmin 时,会弹出一个错误,告诉我primary key 有重复的条目并停止整个操作.
When I export the table from my local db through phpmyadmin and import it through phpmyadmin on my hosting an error pops up telling me that there are duplicate entries for the primary key and stops the whole operation.
如何通过phpmyadmin导入数据,跳过重复的条目,并在流程结束时显示重复的列表?
How can I import the data through phpmyadmin, skip the duplicate entries, and display a list of the duplicates at the end of the process?
我可以做的一个解决方案是在我的主机上调用数据库中主键的所有值,并在导入之前过滤重复项.但我想知道 phpmyadmin 是否有快速解决方案?
A solution that I can do is call all the values of the primary key in the db at my hosting and filter the duplicates before import. BUT I am wondering if there is a quick solution for this with phpmyadmin?
推荐答案
在 phpMyAdmin 的 Settings 选项卡中,您可以尝试检查以下值:
In phpMyAdmin , in Settings tab, you can try checking the following values:
- 设置 -> SQL 查询 -> 忽略多个语句错误
如果您使用的是 CSV 格式:
If you are using CSV format:
- 设置 -> 导入 -> CSV -> 不要因插入错误而中止
如果您使用的是 SQL 格式:
If you are using SQL format:
- 设置 -> 导出 -> SQL -> 使用忽略插入
这篇关于在phpmyadmin中导入时如何跳过重复记录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:在phpmyadmin中导入时如何跳过重复记录
基础教程推荐
- 需要 MySQL 5.1 中的抽象触发器来更新审计日志 2021-01-01
- SQL 效率:WHERE IN 子查询 vs. JOIN 然后 GROUP 2021-01-01
- 是否可以执行按位分组功能? 2021-01-01
- 如何使用 mysql.connector 禁用查询缓存 2022-01-01
- 在 SQL 中连接多个表 2021-01-01
- 无法解决整理冲突 2021-01-01
- SSMS 中的权限问题:“对象 'extended_properties'、数据库 'mssqlsystem_resource'、... 错误 229)上的 SELECT 权限被拒绝" 2022-01-01
- 将 SQL Server DateTime 列迁移到 DateTimeOffset 2021-01-01
- SQL:使用来自具有相同列名的两个表中的数据... 2021-01-01
- SQL Server 实例在登录协商期间返回无效或不受支持的协议版本 2021-01-01
