如何开启多个SQL Workbench/J实例或连接至多个数据库实例?
Hey there! Let's walk through how to fire up multiple SQL Workbench/J instances and connect to multiple database instances without any hassle.
SQL Workbench/J doesn’t restrict you to a single instance by default—here’s how to launch additional ones based on your OS:
Windows
- If you already have one instance open, just double-click the SQL Workbench/J shortcut again (either on your desktop or from the Start Menu) to launch a second instance.
- For command-line users: Open a new Command Prompt window, navigate to your SQL Workbench/J installation directory, and run
SQLWorkbench.exe(or the executable name specific to your setup).
macOS
- From Launchpad or the Applications folder, hold down the Option key while clicking the SQL Workbench/J icon—this will force a new instance to open.
- Via Terminal: Run the command
open -n /Applications/SQLWorkbenchJ.app(adjust the path if you installed it elsewhere). The-nflag tells macOS to open a new instance instead of focusing the existing one.
Linux
- Re-click the SQL Workbench/J launcher from your application menu—most desktop environments will spawn a fresh instance automatically.
- Command-line method: Open a new terminal window and run
sqlworkbenchj(if it’s added to your system PATH) or execute the startup script directly, e.g.,./sqlworkbench.shfrom the installation directory.
You have two solid options here—either manage all connections in a single instance, or spread them across multiple instances:
Option 1: Manage Multiple Connections in One Instance
This is great if you want to switch between databases quickly without juggling windows:
- Open SQL Workbench/J, then click the Connect icon in the toolbar (or go to
File > Connect Window). - In the connection window, click New to create a new connection profile:
- Give it a descriptive name (like "Production PostgreSQL" or "Dev MySQL").
- Select the appropriate database driver for your target DB.
- Fill in the host address, port, database name, username, and password.
- Click Test to verify the connection works, then hit Save to store the profile.
- Repeat this for every database you need to connect to. You’ll see all saved profiles in the connection window—double-click any to open it in a new tab. Switch between tabs to work with different databases.
Pro tip: Customize the connection color in the Advanced tab of the connection profile setup. This will color-code the tab for that connection, making it way easier to spot at a glance.
Option 2: Connect to Different Databases in Separate Instances
If you prefer to keep your database work completely isolated (e.g., running long queries on one DB while editing another), just:
- Launch multiple SQL Workbench/J instances using the methods above.
- In each instance, open the connection window and set up (or select) the specific database connection you want to use for that window.
内容的提问来源于stack exchange,提问作者Dinakar Ullas

