News:

Join the Facebook Fan Page.

Main Menu

Database error

Started by tatack, June 16, 2011, 04:10:18 PM

Previous topic - Next topic

tatack

I am importing a backup database, but I have this error. Why?


Errore

query SQL:

-- -- Dumping data in `smf_log_search_subjects` -- INSERT INTO `smf_log_search_subjects` (`word`, `id_topic`) VALUES (0, 213), (0, 294), (0, 339), (0, 444), (0, 896), (0, 1067), (0, 1560), (0, 1605), (0, 1792), (0, 1942), (0, 1945), (0, 2006), (0, 2341), (0, 2475), (0, 2605), (0, 2606), (0, 2757), (0, 2767), (0, 2798), (0, 2900), (0, 2917), (0, 2935), (0, 3063), (0, 3149), (0, 3228), (0, 3283), (0, 3284), (0, 3519), (0, 3922), ('0€', 1212), ('0-0', 430), (00, 426), (00, 586), (00, 815), (00, 826), (00, 1311), (00, 1755), (00, 1884), (00, 1981), (00, 1986), (00, 2026), (00, 2077), (00, 2079), (00, 2104), (00, 2462), (00, 2465), (00, 2524), (00, 2529), (00, 2585), (00, 2845), (00, 2846), (00, 3111), (00, 3199), (00, 3210), (00, 3228), (00, 3229), (00, 3278), (00, 3397), (00, 3417), (00, 3439), (00, 3466), (00, 3478), (00, 3545), (00, 3546), (00[...]

Messaggio di MySQL: Documentazione
#1062 - Duplicate entry '0-3228' for key 1

kat

I'm no expert... But, I'm guessing that you have "Duplicate entry '0-3228' for key 1", as the error says.

If it's a backup, I have no idea how you'd repair that, though, I'm afraid. :(

Illori

you are overriding a table that already exists with the data with the same primary key, you need to drop the data out of the table before you can restore that backup.

tatack

Quote from: Illori on June 16, 2011, 04:19:59 PM
you are overriding a table that already exists with the data with the same primary key, you need to drop the data out of the table before you can restore that backup.

It is not enough to delete all the table with select all + delete ?

Illori

then you will need to create the table again before you can import the data if you delete the actual table and not just the data in it.

tatack

Quote from: Illori on June 16, 2011, 04:25:32 PM
then you will need to create the table again before you can import the data

How?

Thanks

Illori

in the operations tab in phpmyadmin you can create a new table

tatack

Quote from: Illori on June 16, 2011, 04:35:49 PM
in the operations tab in phpmyadmin you can create a new table

Ok, but how I can know the name of the tables? Another way?  :(

Illori


tatack

Sorry, but I don't understand how.

I'm not an expert of sql  ???

Illori

that is the table name you are looking for smf _log_search_subjects

tatack

Quote from: Illori on June 16, 2011, 04:49:14 PM
that is the table name you are looking for smf _log_search_subjects

Ok, but I have to insert them one to one?
I remember that in the past I made it automatically.

Illori

once you create a fresh table you can import the table and it should work just fine

tatack

And in "Numero campi"?


Illori

i think you can leave that blank

tatack

Quote from: Illori on June 16, 2011, 05:03:54 PM
i think you can leave that blank

No, I have an error message if I leave it black  ::)

Illori

i am not that familiar with creating tables, you might need to wait for someone else to come by and suggest something.

codenaught

The SQL you could manually enter to create that table would be:

CREATE TABLE smf_log_search_subjects (
  word varchar(20) NOT NULL default '',
  id_topic mediumint(8) unsigned NOT NULL default '0',
  PRIMARY KEY (word, id_topic),
  KEY id_topic (id_topic)
) ENGINE=MyISAM;


You can do this by first navigating to your forum's database in phpmyadmin, and then hitting the "SQL" tab at the top of the page.
Dev Consultant
Former SMF Doc Coordinator

tatack

Quote from: akabugeyes on June 16, 2011, 05:23:18 PM
The SQL you could manually enter to create that table would be:

CREATE TABLE smf_log_search_subjects (
  word varchar(20) NOT NULL default '',
  id_topic mediumint(8) unsigned NOT NULL default '0',
  PRIMARY KEY (word, id_topic),
  KEY id_topic (id_topic)
) ENGINE=MyISAM;


You can do this by first navigating to your forum's database in phpmyadmin, and then hitting the "SQL" tab at the top of the page.

After this query what I have to do?

Thanks


Illori

press the esegui button

Advertisement: