Description:
The current welcome message for the mysql command line client is hard coded to:
Welcome to the MySQL monitor. Commands end with ; or \g.
followed by the connection id and copyright notice.
It would be good to allow customizing this message.
How to repeat:
See the source code:
The welcome message is generated in client/mysql.cc:
...
int main(int argc,char *argv[])
{
...
put_info("Welcome to the MySQL monitor. Commands end with ; or \\g.",
INFO_INFO);
my_snprintf((char*) glob_buffer.ptr(), glob_buffer.alloced_length(),
"Your MySQL connection id is %lu\nServer version: %s\n",
mysql_thread_id(&mysql), server_version_string(&mysql));
put_info((char*) glob_buffer.ptr(),INFO_INFO);
put_info(ORACLE_WELCOME_COPYRIGHT_NOTICE("2000"), INFO_INFO);
...
int put_info is defined in the same file:
...
static int put_info(const char *str,INFO_TYPE info,uint error=0,
const char *sql_state=0);
...
static int
put_info(const char *str,INFO_TYPE info_type, uint error, const char *sqlstate)
{
...
if (!opt_silent || info_type == INFO_ERROR)
{
...
So the message is hard coded and only the silent option affects it.
Suggested fix:
A few options exists:
1. Let the server push it through to the client. This will have the advantage that you always get the server specific message no matter which client you connect with and it doesn't allow the client to overwrite the message.
2. A mysql command line client option. The advantage is that each user can set their own header, but the disadvantage is that the DBA doesn't control it.
Description: The current welcome message for the mysql command line client is hard coded to: Welcome to the MySQL monitor. Commands end with ; or \g. followed by the connection id and copyright notice. It would be good to allow customizing this message. How to repeat: See the source code: The welcome message is generated in client/mysql.cc: ... int main(int argc,char *argv[]) { ... put_info("Welcome to the MySQL monitor. Commands end with ; or \\g.", INFO_INFO); my_snprintf((char*) glob_buffer.ptr(), glob_buffer.alloced_length(), "Your MySQL connection id is %lu\nServer version: %s\n", mysql_thread_id(&mysql), server_version_string(&mysql)); put_info((char*) glob_buffer.ptr(),INFO_INFO); put_info(ORACLE_WELCOME_COPYRIGHT_NOTICE("2000"), INFO_INFO); ... int put_info is defined in the same file: ... static int put_info(const char *str,INFO_TYPE info,uint error=0, const char *sql_state=0); ... static int put_info(const char *str,INFO_TYPE info_type, uint error, const char *sqlstate) { ... if (!opt_silent || info_type == INFO_ERROR) { ... So the message is hard coded and only the silent option affects it. Suggested fix: A few options exists: 1. Let the server push it through to the client. This will have the advantage that you always get the server specific message no matter which client you connect with and it doesn't allow the client to overwrite the message. 2. A mysql command line client option. The advantage is that each user can set their own header, but the disadvantage is that the DBA doesn't control it.