以管理员身份运行的命令提示符界面代码:
(c) Microsoft Corporation。保留所有权利。
C:\Windows\system32>net start mysql57
请求的服务已经启动。
请键入 NET HELPMSG 2182 以获得更多的帮助。
C:\Windows\system32>mysql -h localhost -u root -p
Enter password:
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
C:\Windows\system32>mysql -h localhost -u root -p
MySQL Workbench错误提示界面:
[Window Title]
MySQL Workbench
[Main Instruction]
Cannot Connect to Database Server
[Content]
Your connection attempt failed for user 'root' to the MySQL server at localhost:3306:
Access denied for user 'root'@'localhost' (using password: YES)
Please:
1 Check that MySQL is running on address localhost
2 Check that MySQL is reachable on port 3306 (note: 3306 is the default, but this can be changed)
3 Check the user root has rights to connect to localhost from your address (MySQL rights define what clients can connect to the server and from which machines)
4 Make sure you are both providing a password if needed and using the correct password for localhost connecting from the host address you're connecting from
[Close]
根据描述很可能是用户授权问题,看一下localhost对应的账号和密码,如果都正确,就要查看是否有localhost访问权限了,一般默认是有的,如果有人改了授权,指定了某个ip能访问,那就无法访问了,需要管理员进行授权,如果是远程访问也需要授权。具体得看报错的错误码,比如10038
你的mysql 是什么版本?
按提示检查
1、mysql 是否安装好,而且启动了, 增加了localhost 访问许可。
2、3306 端口是否开放, 看看是否加入防火墙的白名单
3、你的连接方式是不是连到localhost
4、root 密码是否正确?
密码输入界面因为CSDN提交不能使用星号所以删了