mysql安装 - Mac 上安装mysql出现的问题.ERROR 1045 (28000):...
PHP中文网
PHP中文网 2017-04-17 13:46:44
0
3
982
  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中文网

认证高级PHP讲师

reply all(3)
阿神

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"
大家讲道理

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

大家讲道理

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;
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template