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

**URL:** <https://help.nextcloud.com/t/script-nc-sql-zero-config-commandline-client-for-the-nextcloud-database/195088>\
**Category:** 📑 How to\
**Tags:** postgresql, database, mysql, aio, admin-scripts\
**Created:** [June 13, 2024, 11:48pm UTC](https://help.nextcloud.com/t/script-nc-sql-zero-config-commandline-client-for-the-nextcloud-database/195088 "2024-06-13T23:48:10Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![ernolf](https://help.nextcloud.com/user_avatar/help.nextcloud.com/ernolf/32/77874_2.png) [@ernolf](https://help.nextcloud.com/u/ernolf)\
**Post date:** [June 13, 2024, 11:48pm UTC](https://help.nextcloud.com/t/script-nc-sql-zero-config-commandline-client-for-the-nextcloud-database/195088/1 "2024-06-13T23:48:10Z")

</div>

* * *

**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** ←](https://github.com/ernolf/ebtb).

Install it this way:

```sh
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](https://github.com/ernolf/ebtb), it comes signed and does an integrity check on the first run and checks for updates on every startup.

Simply run it:

```sh
nc-sql

```

This is the help output:

```sh
# 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

==========================================

- PayPal:  
[PayPal.Me @ernolf](https://paypal.me/ernolf)
- Github Sponsors:  
[Github Sponsors @ernolf](https://github.com/sponsors/ernolf)
- Bitcoin to  
`bc1qwlcqc7zsak45vwqk0dt7hnxlrta7syzstgf7t8`
- Ethereum, BNB Smart Chain, Polygon to  
`0x72b7901b3daa45a7266A77Aa3B3552aB686d0D0D`
- Solana to  
`E7e13hBB7rmhY2N1MqAY88TKobBktJA7rSpTZWAPec6Y`

==========================================
