Centos7s mysql-shell学习 笔记

1.安装:官网下载安装包RPM 或者 源码包

使用YUM 源恩地安装 

:yum localinstall mysql_shell*.rpm

2.进入msyql命令

mysqlsh --uri root@localhost:3306

使用\? 可以有提示介绍常用命令

 

命令别名/快捷方式描述

\help

\h or \?

打印有关MySQL Shell的帮助,或搜索在线帮助。

\quit

\q or \exit

退出MySQL Shell。

\

 

在SQL模式下,开始多行模式。输入空行时,将缓存并执行代码。

\status

\s

显示当前的MySQL Shell状态。

\js

 

将执行模式切换为JavaScript。

\py

 

将执行模式切换为Python。

\sql

 

将执行模式切换为SQL。

\connect

\c

连接到MySQL服务器。

\reconnect

 

重新连接到同一MySQL服务器。

\use

\u

指定要使用的架构。

\source

\. or source (no backslash)

使用活动语言执行脚本文件。

\warnings

\W

显示语句生成的任何警告。

\nowarnings

\w

不要显示语句生成的任何警告。

\history

 

查看和编辑命令行历史记录。

\rehash

 

手动更新自动完成名称缓存。

\option

 

查询和更改MySQL Shell配置选项。

\show

 

使用提供的选项和参数运行指定的报告。

\watch

 

使用提供的选项和参数运行指定的报告,并定期刷新结果。

\edit

\e

在默认系统编辑器中打开一个命令,然后将其显示在MySQL Shell中。

\system

\!

运行指定的操作系统命令,并在MySQL Shell中显示结果。

Option NameDescriptionIntroduced
--Start of API command line integration 
--auth-methodAuthentication method to use 
--clusterConnect to an InnoDB cluster8.0.4
--column-type-infoPrint metadata for columns in result sets8.0.14
--compressCompress all information sent between client and server8.0.14
--connect-timeoutConnection timeout for global session8.0.13
--credential-store-helperThe Secret Store helper for passwords8.0.12
--databaseThe schema to use (alias for --schema) 
--dbaEnable X Protocol on connection with MySQL 5.7 server 
--dba-log-sqlLog SQL statements that are executed by AdminAPI operations8.0.18
--dbpasswordPassword to use when connecting to server 
--dbuserMySQL user name to use when connecting to server 
--executeExecute the command and quit 
--fileFile to process in batch mode 
--forceContinue in SQL and batch modes even if errors occur 
--get-server-public-keyRequest RSA public key from server 
--helpDisplay help message and exit 
--histignoreStrings that are not added to the history8.0.3
--hostHost on which MySQL server instance is located 
--importImport JSON documents from a file or standard input8.0.13
--interactiveEmulate Interactive mode in batch mode 
--js--javascriptStart in JavaScript mode 
--jsonPrint output in JSON format 
--log-levelSpecify logging level 
-maDetect connection protocol for session automatically8.0.3
--mysql-mcCreate a session using classic MySQL protocol8.0.3
--mysqlx-mxCreate a session using X Protocol8.0.3
--name-cacheEnable automatic loading of table names based on the active default schema8.0.4
--no-name-cacheDisable autocompletion8.0.4
--no-passwordNo password is provided for this connection 
--no-wizard--nwDisable the interactive wizards 
--pagerThe external pager tool used to display output8.0.13
--passwordPassword to use when connecting to server (alias for --dbpassword) 
--passwords-from-stdinRead the password from stdin 
--portTCP/IP port number for connection 
--py--pythonStart in Python mode 
--quiet-startStart without printing introductory information 
--recreate-schemaDrop and recreate schema 
--redirect-primaryEnsure connection to an InnoDB cluster's primary8.0.4
--redirect-secondaryEnsure connection to an InnoDB cluster's secondary 
--result-formatSet the output format for this session8.0.14
--save-passwordsHow passwords are stored in the Secret Store8.0.12
--schemaThe schema to use 
--server-public-key-pathPath name to file containing RSA public key 
--show-warningsShow warnings after each statement if there are any (in SQL mode) 
--socketUnix socket file or Windows named pipe to use (classic MySQL protocol only) 
--sqlStart in SQL mode, auto-detecting protocol to use for connection 
--sqlcStart in SQL mode using a classic MySQL protocol connection 
--sqlxStart in SQL mode using an X Protocol connection8.0.3
--ssl-caFile that contains list of trusted SSL Certificate Authorities 
--ssl-capathDirectory that contains trusted SSL Certificate Authority certificate files 
--ssl-certFile that contains X.509 certificate 
--ssl-cipherName of the SSL cipher to use 
--ssl-crlFile that contains certificate revocation lists 
--ssl-crlpathDirectory that contains certificate revocation list files 
--ssl-keyFile that contains X.509 key 
--ssl-modeDesired security state of connection to server 
--tabbedDisplay output in tab separated format 
--tableDisplay output in table format 
--tls-versionPermissible TLS protocol for encrypted connections 
--uriSession information in URI format 
--userMySQL user name to use when connecting to server (alias for --dbuser) 
--verboseActivate verbose output to the console8.0.17
--versionDisplay version information and exit 
--verticalDisplay all SQL results vertically

 

使用小技巧:

\? 加 命令可以有提示

tab 键 可以补全,提示命令;

‘’\‘’ 是mysqshell系统命令输入标记;

"var " 可以给全局变量赋值

 

官方手册介绍:官方手册文本

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值