1、概述 mysql
linux下很久没用mysql,root的密码忘记了,登不上去。网上查了下资料能够从新设置密码。 linux
2、获取密码步骤 sql
1.编辑文件$vim /etc/my.cof vim
在[MySQLd]的下面加上:skip-grant-tables ui
2.重启mysql rest
$/etc/init.d/mysqld restart ip
3.而后登录并修改密码 it
$/usr/bin/MySQL table
$MySQL> USE MySQL ;
$MySQL> UPDATE user SET Password = password(‘new-password’) WHERE User = ‘root’ ;
$MySQL> flush privileges ;
$MySQL> quit; 密码
4.从新改回$/etc/my.cof
去掉1步骤加的字段
5.再重启mysql
$/etc/init.d/mysqld restart
6.搞定,能够用新设置的密码登录了