{question}
How can I customize the SingleStore prompt?
{question}
{answer}
Customizing the SingleStore prompt is particularly beneficial when managing multiple open connections across various terminal windows, enabling you to clearly differentiate between environments or servers.
1. Set Custom Prompt at Startup
You can customize the SingleStore prompt using the --prompt
Option when launching the client:
singlestore --prompt="singlestore 9.0> " -uroot -pPassword@123
singlestore 9.0>
2. Change Prompt Interactively in an Active Session
If you are already in the client, you can modify the prompt using the prompt
command:
singlestore> prompt SingleStore Staging Env >
PROMPT set to 'SingleStore Staging Env >'
SingleStore Staging Env >
You can also use the shorthand command \R
:
singlestore> \R SingleStore Staging Env >
PROMPT set to 'SingleStore Staging Env >'
SingleStore Staging Env >
3. Use Dynamic Placeholders in the Prompt
SingleStore supports several special sequences for dynamic information:
\h
– Hostname\d
– Current database\u
– Current user\t
– Current time (HH:MM:SS)\D
– Full date and time\R
– Hour (24-hour format)\m
– Minutes\s
– Seconds
Examples:
Show hostname:
singlestore> \R \h>
PROMPT set to '\h>'
172.31.12.211>
Show current database:
singlestore> \R \d>
PROMPT set to '\d>'
information_schema>
Show current time and Show full date and time:
information_schema>prompt \R:\m:\s>
PROMPT set to '\R:\m:\s>'
17:53:28>
17:53:29>prompt \D>
PROMPT set to '\D>'
Sat Jun 7 17:53:40 2025>
4. Combine Multiple Sequences
You can combine sequences to create a customized and informative prompt:
singlestore> prompt \u@\h [📂 \d] (⏰ \t)>
PROMPT set to '\u@\h [📂 \d] (⏰ \t)> '
root@localhost [📂 (none)] (⏰ )>
root@localhost [📂 (none)] (⏰ )> use memsql
Database changed
root@localhost [📂 memsql] (⏰ )>
These custom prompts can greatly enhance your workflow and minimize errors when working across multiple environments.
{answer}