Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

A brief introduction to the mysql prompt command

2025-04-01 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)05/31 Report--

This article mainly introduces "brief introduction of mysql prompt command". In daily operation, I believe many people have doubts about the brief introduction of mysql prompt command. The editor consulted all kinds of materials and sorted out simple and easy-to-use operation methods. I hope it will be helpful for you to answer the doubts of "brief introduction of mysql prompt command"! Next, please follow the editor to study!

But today I would like to introduce to you a useful command-- prompt.

[html]

[root@fsailing1] #-uroot-p-- prompt= "\\ u@\\ h:\\ d\\ r:\\ m:\\ s >"

Enter password:

Welcome to the MySQL monitor. Commands end with; or\ g.

Your MySQL connection id is 378 www.2cto.com

Server version: 5.0.95 Source distribution

Copyright (c) 2000, 2011, 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) 08:23:32 > use test

Reading table information for completion of table and column names

You can turn off this feature to get a quicker startup with-A

Database changed

Root@localhost:test 08:23:44 > exit

The advantage of this is that it makes it easier and faster for all of us to operate the database.

You can also configure it in the my.cnf configuration file:

[html]

[mysql]

Prompt=mysql (\\ u@\\ h:\\ d) >

Default-character-set=utf8

[html]

[root@fsailing1 ~] # vim / etc/my.cnf

[root@fsailing1 ~] # service mysqld restart

Stop MySQL: [OK]

Start MySQL: [OK]

[root@fsailing1] # mysql-uroot-p

Enter password:

Welcome to the MySQL monitor. Commands end with; or\ g.

Your MySQL connection id is 2 www.2cto.com

Server version: 5.0.95 Source distribution

Copyright (c) 2000, 2011, 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.

Mysql (root@localhost: (none)) > use test

Reading table information for completion of table and column names

You can turn off this feature to get a quicker startup with-A

Database changed

Mysql (root@localhost:test) >

Here are also some options you need for your reference.

Option Description

\ 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.1.12)

\ 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 (0Mel 23)

\ r The current time, standard 12-hour time (1Mel 12)

\ s Semicolon

\ s Seconds of the current time

\ t A tab character

\ U www.2cto.com

Your full user_name@host_name account name

\ u Your user name

\ v The server version

\ w The current day of 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

X, for any "x" not listed above

At this point, the study of "A brief introduction to the mysql prompt command" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report