I am currently testing Privileged Access Management solutions. I have a need to open the MySQL Workbench with a command line that specifies the server name, and user/password of the privileged account that is being used for that session.

In MSFT SQL Server Studio, you can start it with '-S servername -U username -P password' There doesn't seem to be a straightforward way to do this using the MySQL Workbench. There is a '-query' option, but I can't find anything that specifies how to fully start the app with those parameters supplied dynamically.

Can anyone suggest a way to do this with MySQL Workbench?

1 Answer 1


You can use the query parameter and give it the name of one of the connections you have defined (similar for the admin parameter). This will open a SQL IDE tab with that connection.

Instead of a predefined connection you can also use the usual command line params -h127.0.0.1 -uroot -P3306 in conjunction with the query and admin parameters.

For details how this is parsed look in wb_utils_grt.py (connectionFromString(connstr)).


The documentation says:

--query [connection|connection_string]: Empty: Open a query tab and prompts for a connection.

Connection: Open a named connection.

Connection_string: Create a connection based on the entered connection string, which should be in the form $USER@$HOST:$PORT.

  • Thank you Mike, I am going to test this tonight, and once I can confirm a working solution, I will mark this answered and add additional information to the question showing exactly how it works. Commented Sep 1, 2017 at 19:57
  • Sorry, this does not present a usable solution. There are no named connections, and the command line parameters you provide do not apply to MySql Workbench. According to the MySQL Workbench documentation, it does not appear to be possible. This seems to be a rather odd omission. dev.mysql.com/doc/workbench/en/wb-command-line-options.html Commented Sep 28, 2017 at 21:44
  • I'm not sure what your problem is. The documentation confirms what I said (I added the relevant part here). There is no omission or maybe you mean something totally different. Commented Sep 30, 2017 at 14:08
  • I need to also specify the password on the command line. Unfortunately there doesn't seem to be a way to do that. To fully automate the process, I've had to use an AutoIT script, to populate the password dialog that appears. Commented Sep 30, 2017 at 15:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.