首页 > 解决方案 > 当我登录出现错误时如何修复 MySQL?

问题描述

我可以使用路径登录到 mysql

/usr/local/mysql/bin/mysql -uroot -p

但是当我输入mysql -uroot -p并输入我的密码时,我收到了这个错误:

错误 1045 (28000): 用户 'root'@'localhost' 的访问被拒绝(使用密码:是)

试图弄清楚为什么它仍然提示我输入密码但返回错误?是否有可能我安装了两个单独的 mysql 或者命令mysql -uroot -p设置不正确

Andress-MacBook-Pro:~ alpha$ mysql -uroot -p
Enter password: 
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
Andress-MacBook-Pro:~ alpha$ /usr/local/mysql/bin/mysql -uroot -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 22
Server version: 8.0.17 MySQL Community Server - GPL

Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.


Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql>

我期待使用更简单的命令同样成功登录mysql -uroot -p

标签: mysql

解决方案


推荐阅读