View Full Version : table "user" deleted
chikuru
09-08-2013, 12:28 AM
My old site's database table "user" has been deleted and I have no database backup, Is it possible to make 1 user and make all the post and threads belong to that user? What's the best thing I could do?
ozzy47
09-08-2013, 12:41 AM
You may be able to do the following:
Manually add a new user, then to add the old posts to that user, run this query:
UPDATE post SET userid='xxx' WHERE username='Old Name';
...with 'xxx' being the userid number of the new account and 'Old Name' being the user name on those posts.
After that, rebuild the thread and forum counters in that order:
Admin CP -> Maintenance -> Update Counters
chikuru
09-08-2013, 01:24 AM
How can i manually create a user?
All my user accounts are gone including admin
ForceHSS
09-08-2013, 01:55 AM
Do you have access to MyAdminPHP
chikuru
09-08-2013, 01:57 AM
yes i have phpmyadmin
nerbert
09-08-2013, 02:15 AM
I wouldn't change all those usernames and userids in your post table. Your members will be able to re-register with their original names and maybe then you could deal with getting the userids fixed. Maybe you could hire someone to build some queries to fix that. I'm not very good with mysql but I'm sure someone here could figure it out
--------------- Added 1378611017 at 1378611017 ---------------
I think you can get an admin account in phpMyAdmin as follows:
username: whatever you want
userid: 1
usergroupid: 6
password: d8693d143fb9ade715dcca2b1db93d6f
salt: d`5\MJ1;0G2<BRw2]>u1Jqa3B%Gxw0
Then you should be able to log in with the password "hotdog"
ForceHSS
09-08-2013, 03:32 AM
Or register a new account and login to myadminphp and set the user group for it as 6 then find out the id of your user (you dont need to be a admin to find out user id) then add that userid to the config
nerbert
09-08-2013, 04:00 AM
With that new account ForceHSS suggested change the userid to your old one. If you are the first to register it will be 1 but maybe that's your old userid anyway.
If you can find someone to do the work here's what I think you need:
1. Build a new table called "restore_users" with userid and username fields
2. Query the post table and populate restore_users with usernames and userids from the posts.
3. Get the highest userid from restore_users and create an account with that number + 1 in the user table. I think this will force the next registered user to have a user id one higher than that (max + 2).
4. Create a query against the user table starting with userid = max + 2 that would take a username like JoeBlow_1, query restore_users for JoeBlow get the old userid, then change JoeBlow_1 to JoeBlow and the new userid to the old one from restore_users, then delete JoeBlow from restore_users. You would have to have some page with a button to run this last query and you could run it several times a day as your old users re-register. If I were better at mysql and wasn't busy with other projects I'd do it but like I said before , there are a lot of good coders here you could hire.
tbworld
09-08-2013, 05:15 AM
@nerbert , @ozzy47, @ForceHSS - Nice of you to take the time and point this gentleman in the right direction. :)
ozzy47
09-08-2013, 10:19 AM
Yeah hopefully between all the info he can get it going again. :)
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.