mac@MacBook-Air ~ % sudo /usr/local/mysql/bin/mysqld_safe --skip-grant-tables 2023-06-08T15:09:23.6NZ mysqld_safe Logging to '/usr/local/mysql/data/MacBook-Air.local.err'. 2023-06-08T15:09:24.6NZ mysqld_safe Starting mysqld daemon with databases from /usr/local/mysql/data 2023-06-08T15:11:05.6NZ mysqld_safe mysqld from pid file /usr/local/mysql/data/MacBook-Air.local.pid ended
时间: 2023-07-07 12:46:27 浏览: 243
mysql-8.0.20-macos10.15-x86_64.tar.gz
这个输出表明MySQL已经成功启动,并且正在以跳过权限验证模式运行。请继续按照以下步骤更新root用户的密码:
1. 在终端中输入以下命令以连接到MySQL:
```
mysql -u root
```
2. 切换到mysql数据库,输入以下命令:
```
use mysql;
```
3. 更新root用户密码。输入以下命令:
```
update user set password=PASSWORD("新密码") where User='root';
```
请将“新密码”替换为您要设置的新密码。
4. 刷新MySQL的权限表。输入以下命令:
```
flush privileges;
```
5. 退出MySQL命令行。输入以下命令:
```
exit;
```
6. 停止MySQL服务。在终端中输入以下命令:
```
sudo /usr/local/mysql/support-files/mysql.server stop
```
7. 以正常模式启动MySQL。在终端中输入以下命令:
```
sudo /usr/local/mysql/support-files/mysql.server start
```
现在您应该可以使用新密码登录MySQL了。
阅读全文