I have a MySQL database running in my Mac terminal:
(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>
Now I would like to start running commands from SublimeText3, in a file sql.sql
, with:
show tables
In my SQLToolsCOnnections.sublime-settings-SQLTool
s, I have:
"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"
}
When I do Shift + Cmd + P, I get from Sublime:
"DB CLI mysql cannot be found"
What am I missing?
This problem is directly addressed in the README under "Using SQLTools with Mac OS X". You need to enter the full path to the mysql
binary in your SQLTools.sublime-settings
file. To find the full path, open Terminal and type which mysql
. Next, open Sublime Text → Preferences → Package Settings → SQLTools → Settings
and add the following to the right side:
{
"cli": {
"mysql": "/full/path/to/mysql"
}
}
Save the file and the connection should work.