简体   繁体   中英

How to change the MySQL prompt from the command line

I bet this is easy and I have surely overseen something:

I am trying to set the "internal" MySQL prompt from the Bash shell as an argument to the command mysql .

The manual makes reference a command line option called "--named-command=str" where I assumed that I could pass any of the commands referred here:

mysql Command-line Client

But an version of the command below return an error after connecting to the DB:

mysql --named-commands='\R >'
mysql --named-commands="\R >"

The error reads:

Warning: mysql: ignoring option '--named-commands' due to invalid value '\\R > '

I thus assume that I am missing something. Please note that I have already gone through the MySQL manual/s (both, the Oracle site and the MariaDB site). The fact is that the question itself is not easy to define as when I t yto google for "Mysql Command line option" it normally takes me to the "internal" MySQL command line (or more exactly, the MySQL command line client).

Thanks for your suggestion :)

mysql -h hostname -u username -p --prompt myCustomPrompt \\>

Be sure to escape > with \\ in order to avoid a bash syntax error. See the final section of mysql client commands for instructions on special characters to use in the prompt command.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM