解决mac使用homebrew安装MySQL无法登陆问题
如果你电脑是mac的,使用homebrew安装mysql是一个非常便捷的方式,但是还是会出现一些问题;
首先保证你已经安装了mysql,如果是通过homebrew安装的,输入mysql.server start
启动服务
如果在输入
mysql -u root
出现这个错误error 1045 (28000): access denied for user (using password: yes),应该是修改初始密码没有成功
解决步骤
(1)终端输入mysqld_safe --skip-grant-tables 显示如下
2017-03-21t11:44:11.6nz mysqld_safe logging to '/usr/local/var/mysql/zhongchengmingdemacbook-air.local.err'.
2017-03-21t11:44:11.6nz mysqld_safe logging to '/usr/local/var/mysql/zhongchengmingdemacbook-air.local.err'.
2017-03-21t11:44:11.6nz mysqld_safe a mysqld process already exists
(2)再次输入mysql -u root显示如下
welcome to the mysql monitor. commands end with ; or \g.
your mysql connection id is 10
server version: 5.7.17 homebrew
copyright (c) 2000, 2016, oracle and/or its affiliates. all rights reserved.
oracle is a registered trademark of oracle corporation and/or its
affiliates. other names may be trademarks of their respective
owners.
type 'help;' or '\h' for help. type '\c' to clear the current input statement.
mysql>
(3)终端输入 use mysql显示如下
reading table information for completion of table and column names
you can turn off this feature to get a quicker startup with -a
database changed
mysql>
(4)修改密码update mysql.user set authentication_string=password('你的密码') where user='root';
成功 query ok, 1 row affected, 1 warning (0.05 sec)
rows matched: 1 changed: 1 warnings: 1
以上所述是小编给大家介绍的解决mac使用homebrew安装mysql无法登陆问题,希望对大家有所帮助
上一篇: pytorch 修改预训练model实例
下一篇: iOS图片压缩、滤镜、剪切及渲染等详解
推荐阅读