mysql用戶端登陸配置

來源:互聯網
上載者:User

標籤:account   http   sel   ora   tab   資料   type   int   trade   

my.cnf設定檔參數設定:

[[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]

設定檔參數介紹:
這樣就能很方便的知道當前位於哪個mysql db上,正在以哪個使用者登入,對哪個資料庫進行操作,防止誤操作;並且還能顯示目前時間。
tee="/tmp/query.log" 是把每次查詢的SQL及其結果都記錄到 /tmp/query.log 裡,便於追蹤。
pager="less -i -n -S" 則是把每次輸出都用less來控制顯示,便於輸出結果格式更加容易閱讀,尤其是行記錄長度超過一屏寬度時。

重啟MySQL服務
[[email protected] ~]# /etc/init.d/mysqld restart
Shutting down MySQL.. SUCCESS!
Starting MySQL... SUCCESS!

登入mysql後將有以下提示

[[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) 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)]>
([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)

參考博文地址:http://www.imysql.cn/2008_07_09_show_mysql_client_settings

mysql用戶端登陸配置

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.