1,mysql5.7安装会生成临时密码,需要修改密码;
2,设置系统偏好下选择mysql停止数据库服务;
3,打开终端,输入
cd /usr/local/mysql/bin
sudo su
出现sh-3.2#开头的命令行:./mysqld_safe --skip-grant-tables &
如下图所示
4,再重新开一个终端,分别输入
alias mysql=/usr/local/mysql/bin/mysql
mysql -u -root
编写sql命令:
update mysql.user set authentication_string = password(‘12345678’)where User = ‘root’ and Host = ‘localhost’;
5,密码修改成功,开启服务,可成功连接。
相关文章
- 02-22mac 安装mysql 报错“ERROR 2002 (HY000): Can not connect to local MySQL server through socket '/tmp/mysql.sock' (2)” 解决办法
- 02-22Mac下mysql连接报错:ERROR 1045解决办法
- 02-22mac下mysql 报错 1045 (28000): Access denied for user 'root'@'localhost' (using pass
- 02-22Mac下Mysql遇到ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using
- 02-22mac系统中搭建apache+mysql+php的开发环境,安装mysql后,登录报错:mac ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
- 02-22mac下安装mysql 连接时候报错 ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
- 02-22Spring Boot连接MySQL报错“Internal Server Error”的解决办法
- 02-22Mac下Mysql遇到ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
- 02-22Mysql修改root用户密码 For Mac 报错:ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
- 02-22MAC下登录mysql8错误:ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)