MySQL: Accidently Removed Both root users

Discussion in 'General Software' started by Impotence, Dec 2, 2006.

  1. Impotence

    Impotence May the source be with u!

    Likes Received:
    6
    Trophy Points:
    38
    :notme: Never underestimate the power of a motivated idiot!!! :notme:​


    I managed accidentally remove both BOTH root MySQL using phpMyAdmin (You should have seen my face when it printed out the commands it sent... :/)

    i tried using /usr/bin/mysqld_safe --user=root but phpmyadmin still wont let me login...

    help!

    Note: I am using Ubuntu, but i CAN login as root!
     
  2. Addis

    Addis The King

    Likes Received:
    91
    Trophy Points:
    48
  3. donkey42

    donkey42 plank

    Likes Received:
    9
    Trophy Points:
    38
    :notme: Never underestimate the power of a motivated idiot!!! :notme:​
    :doh: too true:doh: ​
    [ot]i've done some idiotic thing too, i only realize how stupid i was after the event[/ot]
     
  4. Impotence

    Impotence May the source be with u!

    Likes Received:
    6
    Trophy Points:
    38
    Success :D

    Thanks Addis, doubt i would have found "--init-file=temp" without that.

    If anybody else manages this, then here's how you can sort it...

    1. create a text file called "temp" containing the following line and put it in your home folder.
    Code:
    GRANT ALL PRIVILEGES ON *.* TO 'bob'@'%'
    
    2. Kill mysql (You will need to do this as root or with sudo)
    Code:
    /etc/init.d/mysql stop
    
    3. start mysql with the following command, replace 'impotence' with the name of your home folder.
    Code:
    mysqld --init-file=/home/impotence/temp
    
    congrats, you created a fully privileged user called bob (with no password) that can be logged into from anywhere!

    get everything back the way it was and then delete bob!
     
  5. Addis

    Addis The King

    Likes Received:
    91
    Trophy Points:
    48
    Glad you got it sorted :).
     

Share This Page