Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6567685
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T14:22:00+00:00 2026-05-25T14:22:00+00:00

Database is MySQL. I use the django.contrib.auth. Here is all the info: manage.py dumpdata

  • 0

Database is MySQL.

I use the django.contrib.auth.

Here is all the info:

manage.py dumpdata auth > my_auth.json –natural –exclude contenttypes

Then I deleted the entire database (drop database my_database), and created a new database (create database new_database)(use ./manage.py syncdb to create all tables).

Then

manage.py loaddata my_auth.json

I Got an error:

IntegrityError: (1062, “Duplicate entry ‘3-add_author’ for key 2”)

What’s the problem?

Any help will be greatly appreciated. Thank you!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T14:22:00+00:00Added an answer on May 25, 2026 at 2:22 pm

    (Updated)

    You’re right (re your comments below). The problem is indeed with auth.permission.

    When you run syncdb, auth.permission is populated automatically with default values for all installed models. Any subsequent runs of syncdb will add new entries for any models that were recently added.

    If at a later stage you reset the database and run syncdb again, the values will be repopulated and depending on the order in which installed models are inspected, the associated permissions may be added in a different order giving it different ids from your previous database (if models were installed in stages).

    To avoid this problem, you can either leave auth.permission out when dumping your auth data (as you’ve already pointed out in your comments), or resetting the auth.permission table before loading your data dump.

    Also, it is important to use natural keys (--natural) when dumping out your data so that it does not reference related data using its integer id (which may not be the same when loaded in another db). This feature was introduced in Django 1.2.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In one of my Django projects that use MySQL as the database, I need
AFAIK django creates indexes for you in the database (I use MySQL). As these
I'm trying to use dumpdata to generate JSON for a database that is sufficiently
I use the django admin for updating various data on the MySQL database. I
I am trying to modify an existing MySQL database for use in a new
I have made a registration program. Making use of mysql database. Can I still
What database should a beginner use in the C language? Can I use MySQL?
I created a new mysql database and i want to use foreign keys with
I use php to display a table of data drawn from my mysql database.
How get data from mysql database? I use ASP.NET and C#.Previously, I used LINQ

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.