Home  >  Q&A  >  body text

mysql安装 - Mac 上安装mysql出现的问题.ERROR 1045 (28000):...

  1. 描述你的问题
    这个问题从昨天安装开始,百度.Google都找遍了.问题如下:

错误信息:

ERROR 1045 (28000): Access denied for user 'tudou'@'localhost' (using password: NO)

安装的mysql版本是mysql-5.7.10-osx10.10-x86_64
在控制台直接 输入mysql 我记得以前的版本不是这样的啊.我要崩溃了...
然后我尝试了一下

mysql -u root -p 

user 'tudou'@'localhost' 中的tudou是我电脑的用户名.
可以登录成功,为什么直接输入mysql命令会出现以上的问题呢?

PHP中文网PHP中文网2742 days ago942

reply all(3)I'll reply

  • 阿神

    阿神2017-04-17 13:48:44

    Because you enter mysql directly without specifying a user, your current account will be used as the username by default....

    If you only want to enter mysql and use the root account, you can add a line to your shell rc

    alias mysql="mysql -uroot"

    reply
    0
  • 大家讲道理

    大家讲道理2017-04-17 13:48:44

    The problem I encountered the day before yesterday was the same as yours. I directly changed the root password
    What you need is this Mysql5.7 to change the root password

    reply
    0
  • 大家讲道理

    大家讲道理2017-04-17 13:48:44

    Just because the user tudou exists in mac, it does not mean that this user also exists in mysql.

    You can enter the following code in mysql to view mysql users

    SELECT DISTINCT CONCAT('User: ''',user,'''@''',host,''';') AS query FROM mysql.user;

    reply
    0
  • Cancelreply