Opening MySQL database from CLI

Louis-Philippe Allard lp.allard.1 at gmail.com
Mon Jun 8 12:19:13 BST 2020


  Quoting Thomas Baumgart <thb at net-bembel.de>:

> 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
>
>   -------------------------------------------------------------
>
>    

Thomas, it works perfectly with the ampersand and the quotes.  I had  
tried the ampersand at first but forgot to enclose the command in  
quotes...

Thanks a lot!
  Louis-Philippe Allard
lp.allard.1 at gmail.com
Sent using Horde Groupware on GNU/Linux
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kmymoney/attachments/20200608/6c483830/attachment.htm>


More information about the KMyMoney mailing list