Script "nc-sql" - zero config commandline client for the nextcloud database


nc-sql is a commandline client for the nextcloud database (for MySQL/MariaDB and PostgreSQL, no SQLite3)


Whenever you need to quickly make a few queries in the database, but you don’t want to look up the password and the exact call syntax. Just call nc-sql and get started.
It’s basically just a wrapper, but it can make your life a lot easier
Nextcloud All-in-One is supported, containerized solutions other than AIO are not (yet) supported
This script was created with ebtb.

Install it this way:

sudo wget -O /usr/local/bin/nc-sql https://global-social.net/script/nc-sql
sudo chmod +x /usr/local/bin/nc-sql

Explanation:
- the first line downloads the script into the directory /usr/local/bin
- the second line makes it executable

You only need to install it once.
As all of my → ebtb ← scripts, it comes signed and does an integrity check on the first run and checks for updates on every startup.

Simply run it:

nc-sql

This is the help output:

# nc-sql --help

    nc-sql [ --raw [ --execute "query;" ] ]

    nc-sql      open sql cli-client in interactive mode
    --raw, -r   raw output
    --execute,-e "query;"
                run a query and exit

… as you can see, it supports interactive and direct query (execution) mode.

  • You must know sql syntax

I really hope that this tool will make your life easier and save you a lot of searching and time in future.


Much and good luck,
ernolf

1 Like