您的位置:首页 > 数据库 > MySQL

安装mysql 5.7.11,初始登录出现:mysql Access denied for user 'root'@'localhost' (using password: YES)

2016-03-29 22:54 585 查看
纸上学来终觉,绝知此事要躬行

今天在mac上安装mysql 5.7.11,安装快完成的时候,出现弹窗提示:

2016-03-29T13:06:20.543782Z 1 [Note] A temporary password is generated for root@localhost: .XzVm9bi>EGy
If you lose this password, please consult the section How to Reset the Root Password in the MySQL reference manual.
写得很明白:用户名:root,临时的密码:.XzVm9bi>EGy
当时仔细地把这句话给保存下来了,觉得后面的路应该顺风顺水了。
然而,当输入密码的时候:

mysql -uroot -p".XzVm9bi>EGy"
出现错误:

mysql: [Warning] Using a password on the command line interface can be insecure.
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
试过好几次,硬是不对。

然后想,竟然密码不对,那就重新改吧。
结果一找,全部是:mysqld_safe --skip-grant-tables
但是问题是,5.7.11这版本的mysqld_safe根本没有--skip-grant-tables这个参数。
(此处存疑问,如有知道5.7.11如何取回密码的麻烦告知一下,这里的问题并不是这个)
弄了好久,发现正确的方式应该是:
mysql -uroot -p
然后在提示的Enter password:中输入密码即可
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: