Connect to KWDB Using the kwbase CLI Tool
This section explains how to connect to KWDB using kwbase, the built-in command-line interface (CLI) client. You can connect in either insecure mode for testing purposes or secure mode for production environments.
When you deploy KWDB using scripts, the system automatically generates a kw-sql helper script and creates a symbolic link in the /usr/bin directory. This script wraps the kwbase commands, allowing the root user to quickly access the database.
Quick Login Using the Helper Script
Note
The kw-sql script does not support other users. To connect as a different user , use the kwbase command instead.
Prerequisites
KWDB is deployed and started using the deploy.sh script.
Steps
Run the following command from anywhere on the node to connect as root:
kw-sql
Connect Using the kwbase Command
You can also connect directly using the kwbase command. This method lets you specify different users and configure various connection parameters for more flexibility.
Note
For containerized deployments, use this command format:
docker exec -it <container-name> ./kwbase sql [security-options] --host=<your-host-ip> [-u <user-name>]
Insecure Mode
Note
Insecure mode should only be used for testing purposes.
Connect as the database deployment user.
./kwbase sql --insecure --host=<your-host-ip>Connect as a regular user.
./kwbase sql --insecure --host=<your-host-ip> -u <username>
Secure Mode
Connect as the database deployment user.
./kwbase sql --certs-dir=/etc/kaiwudb/certs --host=<your-host-ip>Connect as a regular user.
./kwbase sql --certs-dir=/etc/kaiwudb/certs --host=<your-host-ip> -u <username>