gpt4 book ai didi

MySQL 工作台 : Connecting to database automatically on the startup

转载 作者:行者123 更新时间:2023-11-29 06:29:17 24 4
gpt4 key购买 nike

目前,我必须:

  1. 启动 MySQLWorkBench 8.0
  2. 点击我需要连接的数据库 enter image description here

我愿意:

  1. 启动 MySQLWorkBench 8.0
  2. MySQLWorkBench 会自动连接到此数据库,无需我点击

我每天需要经常重新打开 MySQLWorkbench,因此希望消除此步骤。

最佳答案

我的第一个想法是:如果你经常需要它,就不要关闭它。

但是,如果您愿意从脚本运行 MySQL Workbench,则很容易完成您想要的任务。例如,在终端中打开 /Application 并运行此命令(在 macOS 上):

open -a MySQLWorkbench.app --args --query "Localhost 8.0"

其中“Localhost 8.0”必须更改为您要打开的连接名称。这将打开该服务器的 SQL IDE。您可以将调用放入 shell 脚本中并运行它,而不是应用程序本身。

使用 --help 代替 --query 来打印支持的命令列表:

MySQLWorkbench [<options>] [<name of a model file or sql script>]
Options:
--admin <instance> Open a administration tab to the named instance
--configdir <path> Specify configuration directory location, default is platform specific.
-h, --help Show help options
--log-level <level> Valid levels are: error, warning, info, debug1, debug2, debug3
--log-to-stderr Also log to stderr
--migration Open a migration wizard tab
--model <model file> Open the given EER model file
--open Open the given file at startup (deprecated, use script, model etc.)
--query <connection>|<connection string>Open a query tab and ask for connection if nothing is specified.
If named connection is specified it will be opened,
else connection will be created based on the given connection string,
--quit-when-done Quit Workbench when the script is done
--run <code> Execute the given Python code
--run-python <code> Execute Python code from a file
--run-script <file> Execute Python code from a file
--script <sql file> Open the given SQL file in an connection, best in conjunction with a query parameter
--upgrade-mysql-dbs Open a migration wizard tab
-v, --verbose Enable diagnostics output
--version Show Workbench version number and exit

但是,使用 open 命令时不会显示任何输出(由于其工作方式,另请参阅 How to get the output of an os x application on the console, or to a file? ),但您可以直接运行应用程序二进制文件(而不是应用程序捆绑如上所示),如下所示:

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

关于MySQL 工作台 : Connecting to database automatically on the startup,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57389260/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com