mysql-workbench, how do I write a bash file command as to launch and open a SQL script to a query tab?

StackOverflow https://stackoverflow.com/questions/21796781

Domanda

mysql-workbench, how do I write a bash file command as to launch and open a SQL script to a query tab? I am not sure which parameter I need to pass. thks

ps. Now I am on a Fedora 32. (kind of very late edit, sorry)

È stato utile?

Soluzione

You should always specify which OS you are using.

Generally, you can start MySQL Workbench with various command line paramaters. One of them is --help (-help on Windows). This will give you the following list:

MySQLWorkbench [<options>] [<model file>]
Options:
  --query [<connection>]   Open a query tab to the named connection or prompt for it if none given
  --admin <instance>     Open a administration tab to the named instance
  --upgrade-mysql-dbs    Open a migration wizard tab
  --model <model file>   Open the given EER model file
  --open <file>          Open the given file at startup
  --run <script>         Execute the given code in default language for GRT shell
  --run-python <script>  Execute the given code in Python
  --run-lua <script>     Execute the given code in Lua
  --migration            Open the Migration Wizard tab
  --quit-when-done       Quit Workbench when the script is done
  --log-to-stderr        Also log to stderr
  --help, -h             Show command line options and exit
  --log-level=<level>    Valid levels are: error, warning, info, debug1, debug2, debug3
  --verbose, -v          Enable diagnostics output
  --version              Show Workbench version number and exit

(this is for OS X and Linux, Windows uses a single dash instead). For OS X you also have to use the direct call. So instead of:

open /Applications/MySQLWorkbench.app --args --help

which will not show you the parameters use:

/Applications/MySQLWorkbench.app/Contents/MacOS/MySQLWorkbench --help

To open a connection and load an SQL script file use the following parameters:

... --query "Localhost 5.6" --open /Data/Work/Data/Scripts/alter_test.sql

Again, on Windows use single dashes. For the query parameter use the name of a connection you have defined.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top