【原创】MySQL Proxy - 协议(部分摘录)

本文涉及的产品
云数据库 RDS MySQL Serverless,0.5-2RCU 50GB
简介:

【Generic Response Packets】->【Status Flags】 
   
The status flags are a bit-field: 

======     =============  ========  
   flag               constant name 
======     =============  ========  
0x0001         SERVER_STATUS_IN_TRANS 
0x0002            SERVER_STATUS_AUTOCOMMIT 
0x0008            _`SERVER_MORE_RESULTS_EXISTS` 
0x0010            SERVER_STATUS_NO_GOOD_INDEX_USED 
0x0020            SERVER_STATUS_NO_INDEX_USED 
0x0040            SERVER_STATUS_CURSOR_EXISTS 
0x0080            SERVER_STATUS_LAST_ROW_SENT 
0x0100            SERVER_STATUS_DB_DROPPED 
0x0200            SERVER_STATUS_NO_BACKSLASH_ESCAPES 
0x0400            SERVER_STATUS_METADATA_CHANGED 
0x0800            SERVER_QUERY_WAS_SLOW 
0x1000            SERVER_PS_OUT_PARAMS 
======          =============  ========  



       The capability flags are used by the client and server to indicate which features        they support and want to use.      

【Auth Challenge Packet】->【Capability flags】 

====== =======================  ======================== 
    flags                 constant name                                    description 
====== =======================  ======================== 
0x0001          CLIENT_LONG_PASSWORD           new more secure passwords 
0x0002              CLIENT_FOUND_ROWS                 Found instead of affected rows 
0x0004              CLIENT_LONG_FLAG                     Get all column flags 
0x0008              CLIENT_CONNECT_WITH_DB       One can specify db on connect 
0x0010              CLIENT_NO_SCHEMA                   Don't allow database.table.column 
0x0020              CLIENT_COMPRESS                      Can use compression protocol 
0x0040              CLIENT_ODBC                               Odbc client 
0x0080              _`CLIENT_LOCAL_FILES`                Can use LOAD DATA LOCAL 
0x0100              CLIENT_IGNORE_SPACE               Ignore spaces before '(' 
0x0200              _`CLIENT_PROTOCOL_41`             New 4.1 protocol 
0x0400              CLIENT_INTERACTIVE                   This is an interactive client 
0x0800              CLIENT_SSL                                   Switch to SSL after handshake 
0x1000              CLIENT_IGNORE_SIGPIPE             IGNORE sigpipes 
0x2000              CLIENT_TRANSACTIONS             Client knows about transactions 
0x4000              CLIENT_RESERVED                       Old flag for 4.1 protocol  
0x8000              CLIENT_SECURE_CONNECTION   New 4.1 authentication 
====== =======================  ========================  


【Auth Response Packet】->【  Capability flags   】 

`capability flags` are the same as defined in the `Capability flags`_ of the `Auth Challenge Packet`_ plus: 

====== =======================  ========================   
    flags                 constant name                                    description 
====== =======================  ========================       
0x00010000    _`CLIENT_MULTI_STATEMENTS`      Enable/disable multi-stmt support 
0x00020000    _`CLIENT_MULTI_RESULTS`              Enable/disable multi-results 
0x00040000    _`CLIENT_PS_MULTI_RESULTS`         Multi-results in PS-protocol 
0x40000000    CLIENT_SSL_VERIFY_SERVER_CERT 
0x80000000    CLIENT_REMEMBER_OPTIONS 
====== =======================  ========================  


【  command-type 】 

The first byte of the payload describes the command-type like: 

=== ===================  ========================   
hex           constant name                                      description   
=== ===================  ========================   
00       `COM_SLEEP`_                        unhandled  
01       `COM_QUIT`_                         tells the server that the client wants to close the connection  
02       `COM_INIT_DB`_                    change the default schema of the connection  
03       `COM_QUERY`_                      tells the server to execute a text-based query  
04       `COM_FIELD_LIST`_                get the column definition of a tables  
05       `COM_CREATE_DB`_              create a schema  
06       `COM_DROP_DB`_                 drop a schema  
07       `COM_REFRESH`_                  get a list of active threads  
08       `COM_SHUTDOWN`_            get a list of active threads  
09       `COM_STATISTICS`_               get a list of active threads  
0a       `COM_PROCESS_INFO`_        get a list of active threads  
0b       `COM_CONNECT`_                unhandled  
0c       `COM_PROCESS_KILL`_          ask the server to terminate a connection  
0d      `COM_DEBUG`_                      dump debug info to stdout  
0e       `COM_PING`_                         check if the server is alive  
0f        `COM_TIME`_                         unhandled  
10       `COM_DELAYED_INSERT`_    unhandled  
11       `COM_CHANGE_USER`_        change the user of the current connection  
12        COM_BINLOG_DUMP          (null)  
13       `COM_TABLE_DUMP`_          unhandled  
14       `COM_CONNECT_OUT`_        unhandled  
15        COM_REGISTER_SLAVE        (null)  
16       `COM_STMT_PREPARE`_       creates a prepared statement from the passed query string.  
17       `COM_STMT_EXECUTE`_      asks the server to execute a prepared statement as identified by `stmt-id`.  
18       `COM_STMT_SEND_LONG_DATA`_    sends the data for a column. Repeating to send it, appends the data to the parameter.  
19       `COM_STMT_CLOSE`_         deallocates a prepared statement.  
1a       `COM_STMT_RESET`_         resets the data of a prepared statement. Useful in together with `COM_STMT_SEND_LONG_DATA`_.  
1b       `COM_SET_OPTION`_         set options for the current connection  
1c       `COM_STMT_FETCH`_         (null)   
1d      `COM_DAEMON`_               unhandled  
=== ===================  ========================  

The  unhandled       commands belong to   

* the `Old Commands`_  
* the `Prepared Statements`_ Commands  
* the `Stored Procedures`_ Commands  
* or the Replication Commands  

相关实践学习
基于CentOS快速搭建LAMP环境
本教程介绍如何搭建LAMP环境,其中LAMP分别代表Linux、Apache、MySQL和PHP。
全面了解阿里云能为你做什么
阿里云在全球各地部署高效节能的绿色数据中心,利用清洁计算为万物互联的新世界提供源源不断的能源动力,目前开服的区域包括中国(华北、华东、华南、香港)、新加坡、美国(美东、美西)、欧洲、中东、澳大利亚、日本。目前阿里云的产品涵盖弹性计算、数据库、存储与CDN、分析与搜索、云通信、网络、管理与监控、应用服务、互联网中间件、移动服务、视频服务等。通过本课程,来了解阿里云能够为你的业务带来哪些帮助     相关的阿里云产品:云服务器ECS 云服务器 ECS(Elastic Compute Service)是一种弹性可伸缩的计算服务,助您降低 IT 成本,提升运维效率,使您更专注于核心业务创新。产品详情: https://www.aliyun.com/product/ecs
目录
相关文章
|
7月前
|
关系型数据库 MySQL 数据库
【Navicat 连接MySQL时出现错误1251:客户端不支持服务器请求的身份验证协议;请考虑升级MySQL客户端】
【Navicat 连接MySQL时出现错误1251:客户端不支持服务器请求的身份验证协议;请考虑升级MySQL客户端】
351 0
|
5月前
|
SQL 关系型数据库 分布式数据库
阿里云PolarDB是一款兼容MySQL、PostgreSQL和SQL Server等多种数据库协议的产品
阿里云PolarDB是一款兼容MySQL、PostgreSQL和SQL Server等多种数据库协议的产品
644 6
|
Oracle 网络协议 关系型数据库
MyCat-架构剖析-MySQL 协议简介 | 学习笔记
快速学习 MyCat-架构剖析-MySQL 协议简介
386 0
MyCat-架构剖析-MySQL 协议简介 | 学习笔记
|
SQL 前端开发 关系型数据库
MyCat-架构剖析-MyCat 实现 MySQL 协议 | 学习笔记
快速学习 MyCat-架构剖析-MyCat 实现 MySQL 协议
220 0
MyCat-架构剖析-MyCat 实现 MySQL 协议 | 学习笔记
解决Node.js mysql客户端不支持认证协议引发的“ER_NOT_SUPPORTED_AUTH_MODE”问题
mysql模块(项目地址为https://github.com/mysqljs/mysql)是一个开源的、JavaScript编写的MySQL驱动,可以在Node.js应用中来操作MySQL。但在使用过程中,出现了“ER_NOT_SUPPORTED_AUTH_MODE”问题。
9709 0
|
关系型数据库 MySQL Java
|
SQL 关系型数据库 MySQL
|
监控 MySQL 关系型数据库
|
关系型数据库 MySQL 开发工具
|
关系型数据库 MySQL 开发工具

推荐镜像

更多