Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
2dot5
ClickHouse
提交
0c2aa460
C
ClickHouse
项目概览
2dot5
/
ClickHouse
通知
3
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
C
ClickHouse
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
0c2aa460
编写于
5月 28, 2019
作者:
A
alexey-milovidov
提交者:
GitHub
5月 28, 2019
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #5416 from vitlibar/fix-clickhouse-as-mysql-server
Fix clickhouse as mysql server
上级
bad1e25a
a35d1e0b
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
17 addition
and
6 deletion
+17
-6
dbms/programs/server/MySQLHandler.cpp
dbms/programs/server/MySQLHandler.cpp
+16
-4
dbms/src/Common/ErrorCodes.cpp
dbms/src/Common/ErrorCodes.cpp
+1
-2
未找到文件。
dbms/programs/server/MySQLHandler.cpp
浏览文件 @
0c2aa460
#include <DataStreams/copyData.h>
#include <IO/ReadBufferFrom
Memory
.h>
#include <IO/ReadBufferFrom
String
.h>
#include <IO/ReadBufferFromPocoSocket.h>
#include <IO/WriteBufferFromPocoSocket.h>
#include <Interpreters/executeQuery.h>
...
...
@@ -62,7 +62,7 @@ void MySQLHandler::run()
* This plugin must do the same to stay consistent with historical behavior if it is set to operate as a default plugin.
* https://github.com/mysql/mysql-server/blob/8.0/sql/auth/sql_authentication.cc#L3994
*/
Handshake
handshake
(
server_capability_flags
,
connection_id
,
VERSION_STRING
,
scramble
+
'\0'
);
Handshake
handshake
(
server_capability_flags
,
connection_id
,
VERSION_STRING
+
String
(
"-"
)
+
VERSION_NAME
,
scramble
+
'\0'
);
packet_sender
->
sendPacket
<
Handshake
>
(
handshake
,
true
);
LOG_TRACE
(
log
,
"Sent handshake"
);
...
...
@@ -224,6 +224,10 @@ void MySQLHandler::authenticate(const HandshakeResponse & handshake_response, co
if
(
handshake_response
.
auth_plugin_name
!=
Authentication
::
SHA256
)
{
packet_sender
->
sendPacket
(
AuthSwitchRequest
(
Authentication
::
SHA256
,
scramble
+
'\0'
),
true
);
if
(
in
->
eof
())
throw
Exception
(
"Client doesn't support authentication method "
+
String
(
Authentication
::
SHA256
)
+
" used by ClickHouse"
,
ErrorCodes
::
MYSQL_CLIENT_INSUFFICIENT_CAPABILITIES
);
packet_sender
->
receivePacket
(
response
);
auth_response
=
response
.
value
;
LOG_TRACE
(
log
,
"Authentication method mismatch."
);
...
...
@@ -349,8 +353,16 @@ void MySQLHandler::comQuery(const String & payload)
std
::
function
<
void
(
const
String
&
)
>
set_content_type
=
[
&
with_output
](
const
String
&
)
->
void
{
with_output
=
true
;
};
ReadBufferFromMemory
query
(
payload
.
data
()
+
1
,
payload
.
size
()
-
1
);
executeQuery
(
query
,
*
out
,
true
,
connection_context
,
set_content_type
,
nullptr
);
String
query
=
payload
.
substr
(
1
);
// Translate query from MySQL to ClickHouse.
// This is a temporary workaround until ClickHouse supports the syntax "@@var_name".
if
(
query
==
"select @@version_comment limit 1"
)
// MariaDB client starts session with that query
query
=
"select ''"
;
ReadBufferFromString
buf
(
query
);
executeQuery
(
buf
,
*
out
,
true
,
connection_context
,
set_content_type
,
nullptr
);
if
(
!
with_output
)
packet_sender
->
sendPacket
(
OK_Packet
(
0x00
,
client_capability_flags
,
0
,
0
,
0
),
true
);
}
...
...
dbms/src/Common/ErrorCodes.cpp
浏览文件 @
0c2aa460
...
...
@@ -427,6 +427,7 @@ namespace ErrorCodes
extern
const
int
BAD_TTL_EXPRESSION
=
450
;
extern
const
int
BAD_TTL_FILE
=
451
;
extern
const
int
SETTING_CONSTRAINT_VIOLATION
=
452
;
extern
const
int
MYSQL_CLIENT_INSUFFICIENT_CAPABILITIES
=
453
;
extern
const
int
OPENSSL_ERROR
=
454
;
extern
const
int
KEEPER_EXCEPTION
=
999
;
...
...
@@ -437,8 +438,6 @@ namespace ErrorCodes
extern
const
int
CONDITIONAL_TREE_PARENT_NOT_FOUND
=
2001
;
extern
const
int
ILLEGAL_PROJECTION_MANIPULATOR
=
2002
;
extern
const
int
MYSQL_CLIENT_INSUFFICIENT_CAPABILITIES
=
446
;
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录