1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Reset MySQL "root" Password

Discussion in 'MySQL' started by nayanpaul, Sep 8, 2009.

  1. nayanpaul

    nayanpaul New Member

    Joined:
    Aug 25, 2009
    Messages:
    3
    Likes Received:
    1
    Trophy Points:
    0
    Occupation:
    Student
    Location:
    Kolkata , West Bengal
    Home Page:
    A Best way to reset MySQL user "root" Password.if you have forget it.No worry just follow this simple steps.I hope u will able to do it within 2 minutes.So let's Start Now..
    1.-> Open Microsoft Notepad or type in Run Command Promt notepad , so i hope you have open notepad sucessfully ok now follow next steps carefully.
    2.-> Now Copy and Paste the following text that enclosed between ********* to ******** [bold Faces] in your Notepad , and save as it Microsoft DOS batch Format (.bat file) i.e reset.bat
    i hope you have save this notepad text in .bat format.so reset.bat is your file.
    3.->Now move this reset.bat file to MySQL Server Home Directory i.e if you used General MySQL Server ( No Packages) your Home Directory is C:\Program Files\MySQL\MySQL Server 5.x
    4.-> If You used WAMPP server Packages your reset.bat file should be placed in C:\wampp\bin\mysql directory
    5.->If you used xampp server Package your reset.bat file should be placed in C:\xampp\mysql directory and Double Click when U need to reset MySQL "root" Password.
    6.I hope You will take it. For Any Suggestion or Any mistakes please Mail me nayan.paul@yahoo.com
    **************************************************************************

    @ECHO OFF
    cd/
    taskkill /f /im mysqld.exe

    ECHO USE `mysql`; >resetroot.sql
    ECHO. >>resetroot.sql
    ECHO INSERT IGNORE INTO `user` VALUES ('localhost', 'root', '', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', '', '', '', '', 0, 0, 0, 0); >>resetroot.sql
    ECHO REPLACE INTO `user` VALUES ('localhost', 'root', '', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', '', '', '', '', 0, 0, 0, 0); >>resetroot.sql

    bin\mysqld.exe --no-defaults --bind-address=127.0.0.1 --bootstrap --console --skip-grant-tables --skip-innodb --standalone <resetroot.sql >resetroot.err 2>&1
    IF ERRORLEVEL 1 GOTO MySQL1
    GOTO MySQL2

    :MySQL1
    TYPE resetroot.err
    ECHO.
    ECHO Package Designed by nayan.paul@yahoo.com

    ECHO Passwords for user "root" Has Been Deleted Sucessfully
    ECHO ENJOY Because User "root" Has NO PASSWORD :) :) :)
    ECHO But In Security Reason Please Choose a New Password. :) : :)
    ECHO Please restart the MySQL server Because This Operation has stop the MySQL Server.
    ECHO Thank You For Using This Package.
    GOTO MySQL3

    :MySQL2
    ECHO.
    ECHO Package Designed by
    nayan.paul@yahoo.com

    ECHO Passwords for user "root" Has Been Deleted Sucessfully.
    ECHO ENJOY Because User "root" Has NO PASSWORD :) :) :)
    ECHO But In Security Reason Please Choose a New Password. :) :) :)
    ECHO Please restart the MySQL server Because This Operation has stop the MySQL Server.
    ECHO Thank You For Using This Package.
    GOTO MySQL3

    :MySQL3
    DEL resetroot.err
    DEL resetroot.sql
    ECHO.
    PAUSE


    **************************************************************************
     
  2. shabbir

    shabbir Administrator Staff Member

    Joined:
    Jul 12, 2004
    Messages:
    15,293
    Likes Received:
    365
    Trophy Points:
    83
  3. pradeep

    pradeep Team Leader

    Joined:
    Apr 4, 2005
    Messages:
    1,646
    Likes Received:
    86
    Trophy Points:
    0
    Occupation:
    Programmer
    Location:
    Kolkata, India
    Home Page:

Share This Page