Personalized settings MySQL prompt Interview 4 methods (I) modify the MYSQL_PS1 variable at the Bash layer [plain] [root @ localhost ~] # Export MYSQL_PS1 = "(\ u @ \ h) [\ d]>" [root @ localhost ~] # Mysql-u root-p Enter password: Welcome to the MySQL monitor. commands end with; or \ g. your MySQL connection id is 73 Server version: 5.5.28 MySQL Community Server (GPL) Copyright (c) 2000,201 2, Oracle and/or its affiliates. all rights reserved. oracle is a registered trademark of Oracle Corporation and/or its affiliates. other names may be trademarks of their respective owners. type 'help ;' Or '\ H' for help. type '\ C' to clear the current input statement. (root @ localhost) [(none)]> use test; Database changed (root @ localhost) [test]> (ii) MySQL command line parameter [plain] [root @ localhost ~] # Mysql-u root-p -- prompt = "(\ u @ \ h) [\ d]>" Enter password: Welcome to the MySQL monitor. commands end with; or \ g. your MySQL connection id is 74 Server version: 5.5.28 MySQL Community Server (GPL) Copyright (c) 2000,201 2, Oracle and/or its affiliates. all rights reserved. oracle is a registered trademark of Oracle Corporation and/or its affiliates. other names may be trademarks of their respec Tive owners. type 'help; 'or' \ H' for help. type '\ C' to clear the current input statement. (root @ localhost) [(none)]> (3) configuration file/etc/my. cnf [plain] [mysql] prompt = (\ u @ \ h) [\ d]> \ _ or: [mysql] prompt = "\ r: \ m: \ s> "add a backslash \. (iv) Use the prompt command in MySQL [SQL] mysql> prompt \ r: \ m: \ s \ P> \ _ PROMPT set to '\ r: \ m: \ s \ P> \ _ '08:20:42> prompt Returning to default PROMPT of mysql> Appendix: [plain] Option D Enames \ c A counter that increments for each statement you issue \ D The full current date \ d The default database \ h The server host \ l The current delimiter (new in 5.0.25) \ m Minutes of the current time \ n A newline character \ O The current month in three-letter format (Jan, Feb ,...) \ O The current month in numeric format \ P am/pm \ p The current TCP/IP port or socket file \ R The current time, in 24-hour military time (0-23) \ r The current time, standard 12-hour time (1-12) \ S Semicolon \ s Seconds of the current time \ t A tab character \ U Your full user_name @ host_name account name \ u Your user name \ v The server version \ w The current day the week in three-letter format (Mon, Tue ,...) \ Y The current year, four digits \ y The current year, two digits \ _ A space \ A space (a space follows the backslash) \ 'single quote \ "Double quote \ A literal" \ "backslash character \ x, for any" x "not listed above