网创优客建站品牌官网
为成都网站建设公司企业提供高品质网站建设
热线:028-86922220
成都专业网站建设公司

定制建站费用3500元

符合中小企业对网站设计、功能常规化式的企业展示型网站建设

成都品牌网站建设

品牌网站建设费用6000元

本套餐主要针对企业品牌型网站、中高端设计、前端互动体验...

成都商城网站建设

商城网站建设费用8000元

商城网站建设因基本功能的需求不同费用上面也有很大的差别...

成都微信网站建设

手机微信网站建站3000元

手机微信网站开发、微信官网、微信商城网站...

建站知识

当前位置:首页 > 建站知识

mysql_config_editor用法举例

MySQL_config_editor是一种存储mysql登录信息的工具。

创新互联公司主要从事成都网站设计、网站制作、网页设计、企业做网站、公司建网站等业务。立足成都服务西塞山,十年网站建设经验,价格优惠、服务专业,欢迎来电咨询建站服务:028-86922220

通过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




当前文章:mysql_config_editor用法举例
文章来源:http://bjjierui.cn/article/igooei.html

其他资讯