bitscn.com mysql prompt一个很好用的命令 想必大家在命令行操作mysql的时候会十分发愁现在的操作的是那个数据库吧,至少我就纠结过,可能您会说我打一条命令不就知道了,是的这样做确实可以的。 可是今儿给大家介绍个好用的命令--prompt [html] [root@fsailing1 ~]# mysql -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 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. 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;
这样做的好处就是让我们大家在操作数据库时更加方便快捷。
您也可以在在my.cnf配置文件里进行配置:
[html] [mysql] prompt=mysql(//u@//h://d)> default-character-set=utf8 [html] [root@fsailing1 ~]# vim /etc/my.cnf [root@fsailing1 ~]# service mysqld restart 停止 mysql: [确定] 启动 mysql: [确定] [root@fsailing1 ~]# mysql -uroot -p enter password: welcome to the mysql monitor. commands end with ; or /g. your mysql connection id is 2 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)>
这里也给出需要的一些个选项供大家参考。
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 (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 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 作者 chen861201 bitscn.com