PDA

View Full Version : SQL Partial Imports - Users


TheAllusionist
10-16-2013, 02:55 PM
My sites have really been hit hard this year by hackers and it has really worn me down to a point where I am tired of putting tons of effort into retrieving them back completely to where they were before attacks, but I have a question regarding importing partial SQL files into my vBulletin database.

This last attack was my forums and to get around all the malicious script uploaded into and overwriting my files, I did a fresh install and imported a bit older database that I thought was good. Things aren't bad accept some users had corrupted member information and through repairing the database etc. some are missing. I however have a user only vBulletin export SQL file that I would like to just import into the database, but through MySQL I get errors or time outs. Should be over 25,000 users in the file maybe that is big for uploading into a database, not certain.

The file was an export from MySQL of my user data, so I thought it would import right in, but it isn't seeming to work.

File Imports report:

MySQL said: Documentation
#1062 - Duplicate entry '1-28' for key 'PRIMARY'


If I run a Query I get:

Internal Server Error

The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator, root@localhost and inform them of the time the error occurred, and anything you might have done that may have caused the error.

More information about this error may be available in the server error log.



So if anyone could help me with suggestion on if this can be done I would appreciate it, I am an architect not a server or database expert. I am just trying to get things working and house keeping done before everything is moved to a new server I am purchasing.

Thanks in advance for your time and help.

Russell

findingpeace
10-16-2013, 04:15 PM
Hi Russel, I think this is because you already have an existing User table, so it isn't importing. My guess would be that you need to first delete/truncate the entire user table, and then import the other one.

Of course, back up before attempting that!

TheAllusionist
10-16-2013, 08:37 PM
Thank you, I was hoping there was some syntax I could use to just update missing data. I guess not, thank you for your help.

Regards,

Russell

squidsk
10-18-2013, 02:03 AM
Thank you, I was hoping there was some syntax I could use to just update missing data. I guess not, thank you for your help.

Regards,

Russell
You could but it might be more complicated. You'd need to import the data into a temporary table (i.e. temp_user) and run a query like the following:

insert into user (select * from temp_user where userid not in (select userid from user));

TheAllusionist
10-21-2013, 04:55 PM
squidsk, thank you very much, very helpful!