Linux下忘记MySQL的root密码肿么办

别慌,让阿福来教你~

首先修改my.cnf文件

vi /etc/my.cnf

在[mysqld]字段下添加一句:skip-grant-tables

如:

[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
skip-grant-tables

然后按Esc 按冒号,输入wq保存退出

然后重启mysql

然后么,就是输入

mysql

直接就进入mysql密令了

然后输入如下命令

USE mysql ;

UPDATE user SET Password = password ( ‘新密码’ ) WHERE User = ‘root’ ;

flush privileges ;

quit

注意哦,上面的命令一行一个回车哦~别忘记后面的分号,不然命令不奏效哦~

然后就是进入my.cnf删除掉我们刚刚加的那一行。

然后就重启mysql

密码就这么搞定了!!

怎么样简单吧?

2333333

 

作者: 阿福

购买时被坑爹的枪手坑了。只知道介绍如何如何的好,不知道介绍其坏处。因此,写此博客,望能给各大网友帮助。

《Linux下忘记MySQL的root密码肿么办》有5个想法

  1. OORRDOORWOOOEDPDpFxKpORRWOWRWZGXPEWWSZRROOORODZDDWROWMRWDODRZOOOWDPEpOEEKGpE
    RORGWDRROWRDGDpGEHJUZGRROERROpWZKPDDEHWOOWRORWDDOZRROORDOOWOOWODROZXZEDKZpGRi
    OROODWRRGROWZDKZHWxuPOOMOZOMOWPRpHKODFKRROORRROOORGMMOROWRDWRWDRORDGXKWKKZpOS
    MOODODRORORZGKDPSWzsSERRMpDRRWEORuKWRPHZMWRWRRRDOMWDBRRROOREMROORROEpSDZEPPZW
    WROOWRROWRRPEKZZSESrSGMRRGPRRRDGRUzWDOoXORWRWROREROOOBORRRRROROROORDEPSRKZXpRr
    OROOODOWRRMHpKKPPXRrsIOMBWGGRWRERDuPGMXoERRRRORROZROORBWMRMOOOOORDRROZFEWEESRI
    RREOWDWRWMRHSOSPSFGJiJZBMMWGOOORWRoUZROSSORORROMROWROOMRRMORWRORRRDMWWHSZGDPER
    MOEORpORORBSUGUSXoSZicPRMMWDROZORZHoOEOEUKORMROOMOWOMORMMRRORORRRMOORDOHZPOpZMi
    RREROEWRORMGHEKSFSLOvsJMRMDWDWpORXFHZRZRSFXRRRRRRMWORMOBRRRRRRRROMRORRWOPpEOHRF
    MRROOEOWROMDHHZUSHvSPsLGMOMDDZpDOEzpWpDERFSpRRMRMMMORRMOMRMRMRRORRMWMDDDEZKOpZO
    RMRMOMRRRROMEGPHXELLGJcIOMROUDIKWBHIDHXKOOISGRMBRBMMRBMMRMRMRMORRMRMORDWDWSWGKRi
    RRRRRRBOROORROWSSDSiGILJGROMHSFJZWWxFzuuSESSPDOORODDOGRORRBMBMMRRRMMRORZWZKKOPRH
    MRWMOOOROROOEOXUJZPvIpvsFWHEHozsJHuovJLcLIoFUUISUIoUzUUHPGORMMOBRRRMMRROEOPEDGZOi
    BODREPZORRRpXSFxouKscILvLxJJxvLLscvccxucxsuxuJuJuxxvssusJoSKOWWMMWOOMRMODOWXREZGi
    MMXZXSHGRMDHIoIuJoFUcscLLJJsccvxcsLcvJxLLsLJsxsxcLrriirrirrJIXSZEZpGOMRROGGPZRZOi
    GpSJUuFSPpHuoJJJusuosLLsxsJLsLscLLLvvcxvLvLcLvcvvrrirrvLLLsLxLJLIFSHRRMRMDOpEOERv
    ccLJsxJuJoJxLxcJsxxxcsLLcLccvcvvvcvcvvLvvvvvivvsoKEWDOWOOROROOWOORWDWRRRRRWWZWWRJ
    EXEKGpPSKSUcvrrrvvxLLvcvvvvrrirrvrrrrrvriicJZRBMBOOGWKXSHUoxooUIHKWDRMRWRORRRGROpi
    OOORORRMMBMBROpSsvirrvrvrriiiiiiiiiiiiicUBMBMOFUFXKZLHRKuEWZSSuJoHXKJIRBRROODWJpRi
    SSKzXuUPuIUHEEMMBMRIviiiiiiiiiiiiiiiisOMBBXcrrLURRMOKGBRiizDMRDHHSWMBJiGBRWiiv uBi
    WFvrDOZGUPISUJiisEMBMRHHKWRBMBMBMBMMMBMBsiirrJSsEBRRMMMKiirJPODEHSHOMBLiMMRHIPSERx
    FriiSMROROBMxLSriiisBMBMBMBMBMRRBMBMBMXiirvvvuSuoHRRROFiicooPSISHoFEBMBiSBMMBRMRRv
    SxriioZRORWSvxSFiriiiKMBMSiiii iiJBMOiiivvsLLcLLvvLvcvxuzJJJJszIzuZMBMrrBRRBRDMOzi
    IJPFzLxuIJvvuLvvcrriiiEMBiirscccsiiMBxiirirrvvLsxLxLLcLvvrvvcvLLuzSXMMBvcMRRBOGRRSi
    cvLJJuxJLuJoxJsLrrrcvriBMRLLLsvLsLOBMviiiiiiirrLcsLxLcvvrrrrrrirLoUSDBMrxBRRMRZRRGii
    civvcvcvLLJssLciiirvcviKBMXrrriirLMBBLSiiiiiiirivvcvvrrrrrriiirircooEMBiHMRRMOGOBEi
    rirrrrrvvsLLvriiiririuSJBBIririiiuZBMoUMiiiiiiiiiirrvvrririiiiiirccJKBJiMBRRRRGOOMc
    rivirrvvvvvrriiiririrZOcBMIrriiiiiIMBEiBSiiiiiriiiiiririiiiiiiiirrvsMM zBRMRMOWORRJ i
    rirvrrrrrrrriiirrrrvrMSxMBsriiiiiiiSMBvoMiiririiiiiiiiiriiiiiiirrvvIMiiBMMRRRRDORBs
    virrrrrrriiirirrrrvrrMcHBDviiiiiiiiiSMBiKuiiriiiiiiiiiiiiiiiriiivvJziiBMBRRRROODMMP
    rirririririiirrrrrrrsDiBMJiiiiiiiiiiiJBBrrrLvvrriiiiiiiiiiirrvrvcxiiLBWRRMOMROOORMO
    virrriiiiirirrvvvvcrxiRMFiiiiiiiiiiiiivMBuiixxsvvrrrriiiiirrrrvri iDBIKMRRRRRWMDRORi
    vrvvrrrririrrvrvcsLviMMKiiiiiiiiiiiiiiiiHBBciiiccLvcvvrrrriiii iKMZroOBORRMGRROGMGi
    ciLvvrrrrirrrivvcrrJBMXrriiiriiii iiiiiiiiKMBzri i izOBHvrsPBRORMRRRMDGRWi
    scJJcvrvrvrrrriiioRBOJrriiiiiiiiiiiiiiiiiiiioRMMKSLriiirvJSORMpJiiivuOMRRRRRRRRRFZRi
    iiiiiiiiiiroZBMWzviiiiiriiiiiiiiiiiiiiiiiiiUFHXGGRWWGGXSsriiirirLHRRWMORORRROxIMi
    KFJLvLvxJFHDOMWPxxILiiivrriririiiiiiiiiiiiiiirxoxJLLrririiiiiiiiirvJKMORRRORRMORIXKi
    ozZPGDWDGpPuJvvrrruxiirrvrrrrrriiiiiiicIEESrvLvirvviriiiiiiiiiiirrLoWMMRRORORRORUvUx
    rirrirrririiiririivSucroSSJxvvrririvsSKZFSSHJriiirrririiiiiiiiiiivLSOBRRORRRRMDBJvrU
    riririiiiiiiiiiiiircUHKPEEGKEXHzouIUzcsLxLLriiiiiirvvriiiiiiiiiircoXMMMRRRRRMOORFiizi
    rirriiiiiiiriiiiiriiivvxuSSSXKHHIzJuiiiiiiiiiiiiiiircLrririiiiirvJFRWRRMOROMMRGOHvici
    virrrrrrririiiirririiiiiiirrrrvriiiriiiiiiiiiiiiriiirvJLvrvrrirrsxWEWRMRRORRBOZORi r
    vrrrrrrrrrrrirrrrrrriririiiiiiiiiiivriiiiiiiiiiiiiirirvoLvrrrrrcJDsIBMMRORRMMRUpRi r
    vivrrrvrvrvrrrrrrrrrrrririiiriiiiiirJriiiiiiiiiiiiirrirLsrrirrcuWriMBRMOORRMMWSIDsii
    LrrvvvrvvvrcccrrrvrrrriririiiriiiriirciriiiiiiirrJzSIsrvriirivFDiiRBMMROOMRBGPoUOIii
    JrLrvvcvcvLLxcccvrvrriririiirrcvvrviiivvLvJxJuSSHIUuIoLrriiisPX DBMMRRORRRMELIzDii
    xccLvvrvvvvLvvLSFHUSzoxsLxJoJJuzoIzovLuFuzoSSHJLrrirrJxcrirzXui oMMMOOORORRBIrxFHii
    JcsLcvvrrrrrvvJzKpoxSHppZKZPKHXUSUPHSxzoUUSUIviiriiirrrrrvSIiivcDMMRWWRRRRBRSvSEHxJ
    voHJLLvrrrirrvvLxILrrrirrvrLsJJzoUoUSFUSIIsvriiiiiiriiirLILiicJPOBMDHRORDRMMLrxZPSJi i
    rsKvsJuLcrrrvrvrvvJLviriiiiiiiiirLxuXPSsviriiiiiiiiiiivsoLvrruuFMMDHKOMRGOMpFirXHii iiiiiii
    iLHLvLLusLvcvvvvrrrxxJLLcsxxssxJJoJsvririiiiiiiiiiirrrcxcLvvxFuRRWSSoRMROZOSJirGrii i iii
    vcXvvvcsoJJcLLvrvrrrcLxLJssLLvcrriiiiiiirrviiiiiiirivsJLxsLvSIERpHziHRRpRGZKriuZ ii ii
    rrSJvLcLsuoJLLvcvcvvrrrrrriririrrvcxLLLLvriiiiiiirirsJssLcvSPUpSSziuMMOOZKHSiiov ii iii
    iiIuvvcvLLJuIuLvLvLcvrvrrrrrvvcLxLLccLsriiiiiiiirivxuxsLvroIJUssFirKBRRExIEuriiiiii iiii i
    iirUrrrLLLLJxoozcvvcLcvvrrivrriririiiriiiiiiiriiiLJJxsccruovrLiLizuEORMpvSSrSiii iiiii
    iiivJirivvvcxLzXKzcrvvcvvvcvvrvrririrrriiiiirirvssLvLvcvIorirrvirssGWOPvrHziKi iiiiii i i
    iiiiLLirrrrvcLsuUpKFcrrvvvvvrvvvrvvvrvrrrvrvvLLsvvvvrrvUsiirivivvisDpGLiiPvivi iiiiiii i
    iiiiiLcivrrrvcxsxJSKZXFJxvcvcvcvLLLvccLLscLcLvvrrrrrrcoviiiiiivvivrHSJv iriic iiiiiii iii i
    i iiiiiriiiiiiirrvvsxIFXSSUIJuJJxJLLvcrrriiiiiiiiiiiri i iiii iiiUri i ii

    阿福快看~(╯‵□′)╯︵┻━┻

    1. ………..我自行摘记的。。与旁人无关。。。另外会改安装目录的,嗯。也不用看这篇文章了,或者说看了这篇文章,他也明白具体的意思了。。然后。。。

发表评论

电子邮件地址不会被公开。 必填项已用*标注