检查 mysql 服务是否正在运行
sudo mysql.server status
启动 mysql
sudo mysql.server start
遇到报错
ERROR! The server quit without updating PID file (/opt/homebrew/var/mysql/CNMACANCNN4FH09.pid).
gm_fonts.dart:1-63
给mysql合适的权限
sudo chown -R mysql:_mysql /opt/homebrew/var/mysql
再次启动 mysql,启动成功
sudo mysql.server start
- 链接 mysql
sudo mysql -uroot
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 20
Server version: 9.1.0 Homebrew
Copyright (c) 2000, 2024, Oracle and/or its affiliates.
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>
- 关闭 mysql
sudo mysql.server stop
Password:
Shutting down MySQL
.... SUCCESS!