当我们用mysql client连接mysql实例的时候我们想要显示我们连接的是那个实例、用哪个账号登录的、现在在哪个database中、现在系统时间等等很多信息的时候,那么mysql prompt将需要配置,以下将介绍prompt的配置详解,以及配置方法:
1、我们可以放在默认配置文件的mysql项目中,当我们登录的时候我们就可以看到如期显示了我们配置的信息:
root@DESKTOP-1T4MD6P:~# more /etc/my.cnf
[mysql]
prompt=\"\\\\u@\\\\h [\\\\d]>\"
root@DESKTOP-1T4MD6P:~# mysql -S /tmp/mysql3306.sock
Welcome to the MySQL monitor. Commands end with ; or \\g.
Your MySQL connection id is 25
Server version: 8.0.23 MySQL Community Server - GPL
Copyright (c) 2000, 2021, Oracle and/or its affiliates.
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)]>
来源:https://www.cnblogs.com/xiaoyouzhiqi/p/14611958.html
图文来源于网络,如有侵权请联系删除。