Enter password: ***** ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password:

Windows下部署MySQL遇到的问题

执行命令mysql -u root -p,然后不论是否输入密码都进不去,信息如下

C:\Windows\system32>mysql -u root -p
Enter password: *****
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: Y
ES)

C:\Windows\system32>mysql -u root -p
Enter password:
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: N
O)

C:\Windows\system32>

Enter password: ***** ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password:_第1张图片

查了网上的资料都说是要修改my.ini这个配置,在mysqld下面加上这么一句话skip-grant-tables
,然后重启mysql

net stop mysql
net start mysql

但我试了并不可行。于是想别的思路;

获取密码

  1、关掉mysql服务

   2、重新初始化数据库,记录下终端的信息,因为密码出来了

   然后开启MySQL服务,登录,输入密码即可

net stop mysql
mysqld --initialize --console
net start mysql
mysql -u root -p

Enter password: ***** ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password:_第2张图片

Enter password: ***** ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password:_第3张图片

你可能感兴趣的:(mysql数据库)