解决办法: 以win系统为例: 1、在my.ini配置文件中的【mysqld】下面添加一句话即可 skip-grant-tables 2、然后重启mysql服务,这时登录是免密码验证的,进去之后修改密码: update mysql.user set authentication_string=password("root") where user="root"; 3、刷新账户 flush privileges; 4、配置文件中去掉skip-grant-tables重启mysql,登录即可