When I connect from the commandline, is it possible to change the welcome message displayed by MySQL?

The current message displays the version, Oracle copyright, etc.

I would also like to display a banner.


To remove welcome message, use --silent switch. But it will also make output nontabular (SELECT's output without boundaries) which looks ugly. To bring tabular output back, use --table switch.

mysql --silent --table -u user_name -p db_name
# or short form
mysql -s -t -u user_name -p db_name

To print your own welcome message, create a script, say, mysql.sh, and use echo to print your banner. Run this script instead of mysql.

Example script:

#!/usr/bin/env bash

echo "Welcome to mysql!"
# "$@" will pass script arguments to mysql.
mysql -s -t "$@"


./mysql.sh -u user_name -p db_name

You can use bash aliases or functions to substitute mysql command with your script, i. e. (assuming you put mysql.sh into your $HOME/bin/):

alias mysql=$HOME/bin/mysql.sh

Then mysql -u user_name -p -db_name will run your script, that will print your banner and run mysql.


Add following in your my.cnf:


or add --silent to your mysql CLI

and try logon trigger to print the banner via "system echo 'my custom message'". With some more creativity, you can customize per user logon message.

  • silent will make SELECTs look ugly without boundaries. – cronfy Feb 29 '16 at 10:44

At the very least, you could suppress the welcome message using the -s or --silent option

# mysql -u... -p -s

It will immediately present the mysql prompt


Perhaps, you may want to create a shell script with the custom welcome or banner that displays prior to logging into mysql.

If you are a little more daring, you could download the source, locate and change the welcome message, recompile all binaries, and install. If you are that daring, have fun with that one.

  • 1
    The -s option is smart, but removes the boundaries (signs |, + and -) when executing SELECT-statements. If on *nix; one option is to use an alias and echo a message prior booting mysql. – mira_mayhem Mar 19 '14 at 12:06

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.