MySQL prompts Duplicate entry. For key error resolution

Source: Internet
Author: User
Tags phpmyadmin

For example: Duplicate entry for key 3 means that the 3rd field in the table has a unique index limit, and you need to insert other distinct values or remove the unique properties of the field.

Look at an example

If you have a phpmyadmin on your site, you can also pass it. He checked that the current self-increment of a table with errors in your database is the same as the maximum value of the self-added field in the table, and This error occurs if the same is the case.

How to check?

1 Enter your phpMyAdmin, and then on the left, select your database of errors.

2 Select the table you have faulted and find the self added field of the table, which is the Auto_increment field for the table.

3) Click Browse, and then according to the self added field descending sort, note the current maximum value of the self added field.

4 Click on the top of the action, you will see the "Table Options" in the Auto_increment item, this is the next one you want to insert the data of the value of the field, if this value and just note the current self added field of the maximum value, it will be an error, So change the value to be larger than the current self added field that you just noted, and then click "Execute" to fix the problem.
The maximum value of the current self-increasing field given in the example is 54, and the next one you want to insert is a value of 55 for the field, which is not a problem.

There is also the case that the value of the self-added field has reached the maximum value of the field, that is, it can not be increased, this situation will also appear the same error message. This is why the error message from my friend's forum is mentioned above. The data type of the self-added field is Mediumint (8) because the data is out of date, causing the field value to exceed the maximum range of 16777215! Fix the wrong data

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.