1

I'd like to set the default prompt on MariaDB across all our database servers for everyone. I assume this would be best done in my.cnf. I can set the prompt in a session, but when I try to add something like prompt=name[/d]>/_ in my.cnf, MariaDB fails to start an complains about it.

What is the proper way to do this?

  • Was that in the [mysql] section (not [mysqld])? Perhaps you mean backslashes instead of slashes? – Rick James Nov 29 '17 at 22:38
  • Check here - it's probably what works on MariaDB also. – Vérace Nov 30 '17 at 10:19
1

across all our database servers for everyone

This is a function of the client. You can't set it on the server. MySQL ships with a client, and a server. The client determines the prompt. There is nothing you can do on the server to fix that. The client could be something totally different that has for its prompt

L33tHAX\###->#

You can see the code here construct_prompt(). Nothing there hits the server. That said, it gets set here in the main

default_prompt = my_strdup(getenv("MYSQL_PS1") ? 
                 getenv("MYSQL_PS1") : 
                 "\\N [\\d]> ",MYF(MY_WME));
current_prompt = my_strdup(default_prompt,MYF(MY_WME));

So it would seem you could set it through the MYSQL_PS1 environmental variable.

  • Thank you, this explains my problems. I basically have to set it in the [mysql] section or the environment variable of each potential client location. – flickerfly Dec 1 '17 at 15:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.