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密码肿么办

赞 (0)

评论 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 阿福快看~(╯‵□′)╯︵┻━┻回复
    • 阿福蛋疼啊。。根本不能看。。回复
  2. 神父不对啊,完全变形了。你看看啊 view-source:http://segmentfault.com/回复
  3. ★Extreme★事实上Linux的程序编译安装目录每个人都可能各不相同,这样写法不能普遍适用……回复
    • 阿福...........我自行摘记的。。与旁人无关。。。另外会改安装目录的,嗯。也不用看这篇文章了,或者说看了这篇文章,他也明白具体的意思了。。然后。。。回复