vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   MYSQL change user id manually (https://vborg.vbsupport.ru/showthread.php?t=94936)

FrozenCreations 08-23-2005 11:38 PM

MYSQL change user id manually
 
heyo, i was wandering threw my vast vast vast database looking at the user table, i went in, clicked on browse,

now, user #1 is obously the person who installed vb... and i need to change his userid form 1 to my user id (4). i tryed doing that in my spot, but when i did, all that happened was my username was changed to user#1's name :) if that makes any sence...

if not, ill try 2 explain it a bit more


basiclly i need 2 change the userids :)

Guest190829 08-23-2005 11:53 PM

[sql]UPDATE user
SET userid = '1'
WHERE userid = '4';[/sql]

[sql]UPDATE user
SET userid = '4'
WHERE userid = '1' AND username= 'username';[/sql]

The above two queries should work, I didn't test them. And I also don't know how this will affect your board. So be warned, and I would test it on a test board before you do it.

And Change 'username' with the username of the user you want to switch.

FrozenCreations 08-23-2005 11:57 PM

#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'table user
SET userid = '1'
WHERE userid = '2'' at line 1

Guest190829 08-23-2005 11:59 PM

Quote:

Originally Posted by FrozenCreations
#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'table user
SET userid = '1'
WHERE userid = '2'' at line 1

You used a double quote instead of a single quote in your where clause.

FrozenCreations 08-24-2005 12:02 AM

lol, whoops, and i thought i copyed it /;

SQL-query :

UPDATE user SET userid = '1' WHERE userid = '4'

MySQL said:

#1062 - Duplicate entry '1' for key 1

and shouldent i have the username 4 teh first 1 aswell?

Guest190829 08-24-2005 12:05 AM

The username isn't needed for the first one since there are not duplicate user-ids. For the second one however, you do need it to prevent the error your getting know.

FrozenCreations 08-24-2005 12:07 AM

lol, and how would i fix it?

do i out them both in?

im only putting in the first 1

should i do both?

and what username do i put in? mine or the other 1?

Guest190829 08-24-2005 12:15 AM

Hm...it seems the userid field must be unique. You can try first setting the user with userid 1 to have a userid that doesn't exist, then change yours to userid 1, and then change his to 4. But I don't know what effect this would have on the database and the auto_increment. Why do you need to this anyway?

FrozenCreations 08-24-2005 12:18 AM

i just to be #1 thats all ;) i was on our old site... but he installed vb, (and is nolonger active)

and doing that... wouldent that change all the users posts... llike swttch em around?

al user 1's posts becoume user #4 posts... so on?

Guest190829 08-24-2005 12:20 AM

Quote:

Originally Posted by FrozenCreations
i just to be #1 thats all ;) i was on our old site... but he installed vb, (and is nolonger active)

and doing that... wouldent that change all the users posts... llike swttch em around?

al user 1's posts becoume user #4 posts... so on?

Not sure, that's why I'm so iffy on doing it. I don't know the side-effects. If I were you, I'd leave myself as 4.

FrozenCreations 08-24-2005 12:25 AM

if someone would make a hack of this...! i would love em 2 no extent!

(i added you 2 icq... :))

Andreas 08-24-2005 12:40 AM

Sorry, but what the Hell are you guys trying to do?

If you really want to change the Userids you will need a whole bunch of queries.
(Really not worth it)

FrozenCreations 08-24-2005 12:48 AM

well, still, i would like to have it done!

and im trying 2 change the userids...

1>4
1<4

Marco van Herwaarden 08-24-2005 04:19 AM

Maybe too late but....DON'T EVEN TRY THIS!!!!!!!!!

Guest190829 08-24-2005 05:00 AM

:ermm: Hopefully he listened my warning that I didn't really know what could happen!

Andreas 08-24-2005 07:31 AM

Quote:

Originally Posted by MarcoH64
Maybe too late but....DON'T EVEN TRY THIS!!!!!!!!!

At least not if you don't know exactly what you are doing ... it's a hell of a job to do.

FrozenCreations 08-24-2005 10:48 AM

i have my own bacup server ;) dont worrie.. i test all my crap on that b4 i do it 4 real :)

y? what could it have done?

Marco van Herwaarden 08-24-2005 11:18 AM

The userid is referenced in a dozen tables (and even on some places where it is not just a column called 'userid'), and all would need to be changed at once without any conflicts.

Furthermore changing the userid serves no purpose at all it is just an internal number.

I would say that the chance that you F... Up is about 99%.

Andreas 08-24-2005 11:21 AM

Purpose = It's better for his Ego being Userid #1 ;)

FrozenCreations 08-24-2005 11:25 AM

yup, kerby got it :) and besides.. i the head admin.. and when i go to other sites.. i usually go 2 userid #1 ;), thats all :D

Marco van Herwaarden 08-24-2005 11:32 AM

Then some non-head Admin should cut your head off, for considering risking the board for your own ego.

PS The line above is a joke, but holds some truth in it.

Edit: Added the word 'considering'

FrozenCreations 08-24-2005 11:35 AM

no, i dident do it on MY fourm... i have a backup.. on my harddrive :)

and, just 4 the record.. nothign screwed up on that1... and i changed a ton of crap in teh mysql ;)

Marco van Herwaarden 08-24-2005 12:34 PM

Quote:

Originally Posted by FrozenCreations
no, i dident do it on MY fourm... i have a backup.. on my harddrive :)

and, just 4 the record.. nothign screwed up on that1... and i changed a ton of crap in teh mysql ;)

Just edited my previous post.

FrozenCreations 08-24-2005 09:50 PM

thankyou ;)


All times are GMT. The time now is 11:28 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01697 seconds
  • Memory Usage 1,756KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (4)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (24)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete