Opening MySQL database from CLI
Thomas Baumgart
thb at net-bembel.de
Sun Jun 7 06:49:18 BST 2020
Hello,
On Samstag, 6. Juni 2020 17:24:32 CEST Louis-Philippe Allard wrote:
> Hello,
>
> If this is possible, this should be an easy one for the
> programmers...
... or the user :)
> I am using MySQL databases with KMM 5.0.5, and I
> currently opening them by launching KMM, and selecting the desired DB
> in the recent files menu. This pre-populates the DB opening dialog
> box, and only have to enter the DB password.
>
> I'd like to be able to open a DB directly by calling KMM from the
> shell, something like:
>
> kmymoney
> sql://database-username@database-server/database-name?driver=QMYSQLsecure=yes'
>
> but when I try this, I get:
>
> "Qt SQL driver QMYSQLsecure=yes is no longer installed on your system"
>
> I think its because the "secure=yes" is concatenated to
> "driver=QMYSQL" and the Qt DB driver doesnt like that...
>
> My goal is to create desktop shortcuts for each DB. Once clicked, it
> would reproduce selecting the DB in KMM's recent items menu.
Makes sense. Looking at the source, the application constructs the URL in a way
that it places an ampersand between the QMYSQL and secure. So you need to do the
same when calling from the shell. This may be a bit tricky, as the shell can
interpret the & (ampersand) as instruction to place the command into the background.
You can avoid that by enclosing the whole URL in single quotes. So your command
will look s.th. like
kmymoney 'sql://database-username@database-server/database-name?driver=QMYSQL&secure=yes'
Hope that helps. I have not tried this myself, so in case it does not work
you can get back to us.
--
Regards
Thomas Baumgart
https://www.signal.org/ Signal, the better WhatsApp
-------------------------------------------------------------
You have to wait until you have written code before starting an
open source project, otherwise you have made a standards group.
-- Jeremy Ruston, Head of Open Source Innovation at BT
-------------------------------------------------------------
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kmymoney/attachments/20200607/cd6991b3/attachment-0001.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 868 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.kde.org/pipermail/kmymoney/attachments/20200607/cd6991b3/attachment-0001.sig>
More information about the KMyMoney
mailing list