mac上mysql忘记密码怎么解决?

mac上mysql忘记密码怎么解决?,第1张

概述mac上mysql忘记密码怎么解决

解决方法:首先打开终端,输入命令“MysqL -u root”;然后输入命令“UPDATE MysqL.user SET authentication_string=PASSWORD('新密码') WHERE User='root';”。

(推荐教程:mysql视频教程)

mac 中登陆MysqL忘记密码解决办法

1、打开终端,输入命令:cd /usr/local/MysqL/bin

2、MysqL -uroot -p,用这条命令登陆时报错信息:

报错:

Enter password: ERROR 1045 (28000): Access denIEd for user 'root'@'localhost' (using password: YES)

3、打开终端输入:sudo MysqLd_safe --skip-grant-tables

输出

Password:Logging to '/usr/local/MysqL/data/localhost.err'.2018-10-10T03:21:40.6NZ MysqLd_safe Starting MysqLd daemon with databases from /usr/local/MysqL/data

4、打开一个新的终端,输入:MysqL -u root ,会看到以下输出。

Welcome to the MysqL monitor. Commands end with ; or \g.Your MysqL connection ID is 16Server version: 5.7.23 MysqL Community Server (GPL)copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.Oracle is a registered Trademark of Oracle Corporation and/or itsaffiliates. Other names may be Trademarks of their respectiveowners.Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.MysqL>

5、终端输入 use MysqL显示如下

Reading table information for completion of table and column namesYou can turn off this feature to get a quicker startup with -ADatabase changed

6、修改密码:UPDATE MysqL.user SET authentication_string=PASSWORD('你的密码') WHERE User='root';

query OK, 1 row affected, 1 warning (0.01 sec)Rows matched: 1 Changed: 1 Warnings: 1

相关推荐:@L_403_1@ 总结

以上是内存溢出为你收集整理的mac上mysql忘记密码怎么解决?全部内容,希望文章能够帮你解决mac上mysql忘记密码怎么解决?所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/sjk/1150928.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-31
下一篇 2022-05-31

发表评论

登录后才能评论

评论列表(0条)

保存