环境:
mysql:5.7
问题:
安装完mysql后使用mysql -uroot -p 登陆提示
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
解决方案:
百度一下都是千遍一律的说话,还是在Oracle 的官方文档中找到了答案
A superuser account 'root'@'localhost is created. A password for the superuser is set and stored in the error log file. To reveal it, use the following command:
shell> sudo grep 'temporary password' /var/log/mysqld.log
原来安装mysql的时候系统自动创建了root账号的临时密码
[root@bogon ~]# sudo grep 'temporary password' /var/log/mysqld.log
2017-06-09T10:20:16.551437Z 1 [Note] A temporary password is generated for root@localhost: yLsi%4Zh1f(t
本文介绍了在安装MySQL 5.7后遇到无法使用root用户登录的问题及解决方法。通过官方文档了解到,安装过程中系统会自动生成临时密码,并记录在错误日志文件中。文章提供了查询临时密码的具体命令。
4708

被折叠的 条评论
为什么被折叠?



