mysql_config_editor用法舉例
mysql_config_editor是一種儲存mysql登入資訊的工具。
透過mysql_config_editor設定了登入資訊後,在用mysql命令登入資料庫時就可以只用加一個--login-path=name的引數,
而不用再輸入host,user,password等資訊登陸。
舉例如下:
正常登陸為:
# mysql -uroot -p'123456' --socket=/tmp/mysql.sock
配置config_editor:
#mysql_config_editor set --login-path=9527 --socket=/tmp/mysql.sock --user=root --password
Enter password: --此時輸入123456
列印config_editor資訊:
#mysql_config_editor print --all
[9527]
user = root
password = *****
socket = /tmp/mysql.sock
用mysql --login-path登陸:
#mysql --login-path=9527
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 66820
Server version: 8.0.13 MySQL Community Server - GPL
Copyright (c) 2000, 2018, 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>\s
--------------
mysql Ver 8.0.13 for linux-glibc2.12 on x86_64 (MySQL Community Server - GPL)
Connection id: 66820
Current database:
Current user: root@localhost
SSL: Not in use
Current pager: stdout
Using outfile: ''
Using delimiter: ;
Server version: 8.0.13 MySQL Community Server - GPL
Protocol version: 10
Connection: Localhost via UNIX socket
Server characterset: utf8mb4
Db characterset: utf8mb4
Client characterset: utf8mb4
Conn. characterset: utf8mb4
UNIX socket: /tmp/mysql.sock
Uptime: 23 hours 41 min 42 sec
Threads: 2 Questions: 266 Slow queries: 0 Opens: 380 Flush tables: 2 Open tables: 352 Queries per second avg: 0.003
--------------
mysql>quit
Bye
reset 刪除config_editor日誌的所有內容
# mysql_config_editor reset
開發shell指令碼時不提示密碼方法:
# cd ~
# vim .my.cnf
[client]
user=root
password=123456
直接敲mysql就能登陸,不需要輸入密碼:
# mysql
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 132246
Server version: 8.0.13 MySQL Community Server - GPL
Copyright (c) 2000, 2018, 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 >quit
Bye
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/15498/viewspace-2564016/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- Python qutip用法(舉例介紹)Python
- 【mysql】SUBSTRING_INDEX 用法舉例MySqlIndex
- jquery九大選擇器的用法舉例jQuery
- 使用Java JUnit框架裡的@Rule註解的用法舉例Java框架
- Selenium用法詳解 -- Selenium3 自動化測試 frame多種用法舉例
- PostgreSQL9.x,10,11hash分割槽表用法舉例SQL
- HTTP 請求響應頭部欄位裡 ETAG 的用法舉例HTTP
- mysql_config_editorMySql
- JAVA反射舉例Java反射
- 死鎖-舉例
- Java 列舉 switch的用法Java
- Swift列舉的全用法Swift
- mysql_config_editor元件MySql元件
- RDD用法與例項(五):glom的用法
- mysql_config_editor 配置工具MySql
- golang Context應用舉例GolangContext
- Java enum列舉類詳解 列舉的常見用法Java
- Travis CI 配置檔案 .travis.yml 的語法介紹和一些用法舉例
- 設計模式應用舉例設計模式
- java 正規表示式 舉例Java
- Java Stream六個使用舉例Java
- (舉例)Laravel 怎麼分表Laravel
- 舉例說明如何使用WebSQL?WebSQL
- torch.argmin()的使用舉例
- hadoop專案開發案例舉例Hadoop
- 前端模板引擎Handlebars理解與舉例前端
- 舉例說明clear取值有哪些?
- 反直覺SQL舉例說明SQL
- 舉例說明js如何拖拽排序?JS排序
- MySQL遠端備份策略舉例MySql
- 舉例巧析IE工業工程
- Spark UDAF實現舉例 -- average poolingSpark
- 淺克隆深克隆舉例解讀
- VBox和HBox的用法及用例
- JS中排序的用法和例項JS排序
- Java 利用列舉實現單例模式Java單例模式
- 安卓EventBus使用方法,eventbus舉例安卓
- 反正舉例教你規範寫程式碼