SublimeText3 和 MySQL - 找不到 DB CLI mysql

SublimeText3 and MySQL - DB CLI mysql cannot be found

我的 Mac 终端中有 mysql 数据库 运行:

(base) Johns-MacBook-Pro-3:~ johndoe$ mysql -u root -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 12
Server version: 8.0.20 MySQL Community Server - GPL

Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved.

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> 

现在我想从 SublimeText3 启动 运行 命令,在文件 sql.sql 中,其中:

show tables

我是我的 SQLToolsCOnnections.sublime-settings-SQLTool,我有:

"Connection MySQL": {
  "type"    : "mysql",
  "host"    : "127.0.0.1",
  "port"    :  3306,
  "database": "giraffe",
  "username": "root",
  // use of password for MySQL is not recommended (use "defaults-extra-file" or "login-path")
  "password": "pwd",  // you will get a security warning in the output
  // "defaults-extra-file": "/path/to/defaults_file_with_password",  // use [client] or [mysql] section
  // "login-path": "your_login_path",  // login path in your ".mylogin.cnf"
  "default-character-set": "utf8",
  "encoding": "utf-8"
}

当我做shift + cmd + P时,我从sublime得到:

"DB CLI mysql cannot be found"

我错过了什么?

这个问题直接在 README 下的“Using SQLTools with Mac OS X”下直接解决。您需要在 SQLTools.sublime-settings 文件中输入 mysql 二进制文件的完整路径。要查找完整路径,请打开终端并键入 which mysql。接下来,打开Sublime Text → Preferences → Package Settings → SQLTools → Settings,在右侧添加以下内容:

{
    "cli": {
        "mysql": "/full/path/to/mysql"
    }
}

保存文件,连接应该可以正常工作。