3 回答

TA贡献1848条经验 获得超6个赞
1.以系统管理员身份登陆系统。
2.打开cmd-----net start 查看mysql是否启动。启动的话就停止net stop mysql.
3.我的mysql安装在d:\usr\local\mysql4\bin下。
4.跳过权限检查启动mysql.
d:\usr\local\mysql\bin\mysqld-nt --skip-grant-tables
5.重新打开cmd。进到d:\usr\local\mysql4\bin下:
d:\usr\local\mysql\bin\mysqladmin -u root flush-privileges password "newpassword"
d:\usr\local\mysql\bin\mysqladmin -u root -p shutdown 这句提示你重新输密码。
6.在cmd里net start mysql
7.搞定了。

TA贡献2019条经验 获得超9个赞
方法一:
# /etc/init.d/mysql stop
# mysqld_safe --user=mysql --skip-grant-tables --skip-networking &
# mysql -u root mysql
mysql> update user set password=password(newpassword) where user=root;
mysql> flush privileges;
mysql> quit
# /etc/init.d/mysql restart
# mysql -uroot -p
enter password: <输入新设的密码newpassword>
mysql>
方法二:
直接使用/etc/mysql/debian.cnf文件中[client]节提供的用户名和密码:
# mysql -udebian-sys-maint -p
enter password: <输入[client]节的密码>
mysql> update user set password=password(newpassword) where user=root;
mysql> flush privileges;
mysql> quit
# mysql -uroot -p
enter password: <输入新设的密码newpassword>
mysql>
- 3 回答
- 0 关注
- 1158 浏览
添加回答
举报