my.cnf configuration file parameter settings:
[Email protected] ~]# head-7/etc/my.cnf
[mysql]prompt="(\\[email protected]\\h:\R:\m:\\s)[\\d]> "pager="less -i -n -S"tee="/tmp/query.log"no-auto-rehash[mysqld]
Configuration file parameters are described:
This makes it easy to know which MySQL DB is currently on, which user is logged in, which database to operate against, and how the current time can be displayed.
Tee= "/tmp/query.log" is the SQL of each query and its results are recorded in the/tmp/query.log, easy to track.
pager= "Less-i-n-s" is to use less to control the display of each output, which makes the output format easier to read, especially when the line record length is more than one screen width.
To restart the MySQL service :
[Email protected] ~]#/etc/init.d/mysqld restart
Shutting down MySQL. success!
Starting MySQL ... success!
after logging in to MySQL, you will be prompted with the following :
[[email protected] ~]# mysql-uroot-p ' xiaowytest '-s/tmp/mysql3307.sock **logging to file '/tmp/ Query.log ' **warning:using a password on the command line interface can be insecure. Welcome to the MySQL Monitor. Commands End With; or \g.your MySQL connection ID is 2Server version:5.6.20-log mysql Community Server (GPL) Copyright (c) +, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or itsaffiliates. Other names trademarks of their respectiveowners. Type ' help ', ' or ' \h ' for help. Type ' \c ' to clear the current input statement. ([email protected]:17:53:43) [(None)]>
([email protected]:17:53:43)[(none)]> use ranzhidb;Database changed([email protected]:17:56:15)[ranzhidb]> select id,account from droa_attend where id=10 and account=‘xiawu‘;Empty set (0.00 sec)([email protected]:17:57:08)[ranzhidb]> select id,account from droa_attend where id=10 and account=‘xiaowu‘;+----+---------+| id | account |+----+---------+| 10 | xiaowu |+----+---------+1 row in set (0.00 sec)
[Email protected] ~]# Tailf/tmp/query.log
Server version: 5.6.20-log MySQL Community Server (GPL)Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.Oracle is a registered trademark of Oracle Corporation and/or itsaffiliates. Other names may be trademarks of their respectiveowners.Type ‘help;‘ or ‘\h‘ for help. Type ‘\c‘ to clear the current input statement.([email protected]:17:53:43)[(none)]> use ranzhidb;Database changed([email protected]:17:56:15)[ranzhidb]> select id,account from droa_attend where id=10 and account=‘xiawu‘;Empty set (0.00 sec)([email protected]:17:57:08)[ranzhidb]> select id,account from droa_attend where id=10 and account=‘xiaowu‘;+----+---------+| id | account |+----+---------+| 10 | xiaowu |+----+---------+1 row in set (0.00 sec)
Reference Post address: http://www.imysql.cn/2008_07_09_show_mysql_client_settings
MySQL Client login configuration