日期:2014-05-16 浏览次数:20828 次
windows环境中:%MySQL_installdir%\my.ini //一般在MySQL安装目录下有my.ini即MySQL的配置文件。 linux环境中:/etc/my.cnf 在[MySQLd]配置段添加如下一行: skip-grant-tables
windows环境中: net stop MySQL net start MySQL linux环境中: /etc/init.d/MySQLd restart
MySQL -uroot -p MySQL
直接回车无需密码即可进入数据库了。
现在我们执行如下语句把root密码更新为 7758521:
update user set password=PASSWORD("yourpassword") where user='root';
quit 退出MySQL。