-
1. 停止mysql服务,可以在偏好设置里停止,也可以用命令执行。
-
2. cd /usr/local/mysql/bin/
-
3. sudo ./mysqld_safe -- skip-grant-tables, 这样mysql服务会启动
-
4. 新开一个终端,/usr/local/mysql/bin/mysql 无密码进入mysql
-
5. 选择数据库
mysql>use mysql; -
mysql>show tables; -
mysql> describe user; -
6. 这里会发现这个表里其实没有password这一行,其实Mac下面的账户密码是authentication_string这一行跟其他版本不一样。| plugin | char(64) | NO | | mysql_native_password | | | authentication_string | text | YES | | NULL | | | password_expired | enum('N','Y') | NO | | N | | | password_last_changed | timestamp | YES | | NULL | | | password_lifetime | smallint(5) unsigned | YES | | NULL | | | account_locked | enum('N','Y') | NO | | N | | +------------------------+-----------------------------------+------+-----+-----------------------+-------+ -
7. 设置新密码
mysql>update user set authentication_string=password('1111') where user='root'; -
mysql> flush privileges; -
Mac Mysql忘记密码重置备忘
最新推荐文章于 2025-12-17 23:42:50 发布
本文介绍在Mac系统中如何重置MySQL的管理员密码。包括停止MySQL服务、使用命令行跳过权限表启动服务、连接MySQL并更新root用户的认证字符串等步骤。
947

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



