mycat php,php连接mycat,日志出现Unknown command

php连接mycat的驱动类用的是liu21st的DbMysql.class.php

主要代码如下:

/**

* 连接数据库方法

* @access public

* @throws ThinkExecption

*/

public function connect($config='',$linkNum=0,$force=false) {

if ( !isset($this->linkID[$linkNum]) ) {

if(empty($config)) $config = $this->config;

// 处理不带端口号的socket连接情况

$host = $config['hostname'].($config['hostport']?":{$config['hostport']}":'');

// 是否长连接

$pconnect = !empty($config['params']['persist'])? $config['params']['persist']:$this->pconnect;

if($pconnect) {

$this->linkID[$linkNum] = mysql_pconnect( $host, $config['username'], $config['password'],131072);

}else{

$this->linkID[$linkNum] = mysql_connect( $host, $config['username'], $config['password'],true,131072);

}

if ( !$this->linkID[$linkNum] || (!empty($config['database']) && !mysql_select_db($config['database'], $this->linkID[$linkNum])) ) {

throw_exception(mysql_error());

}

$dbVersion = mysql_get_server_info($this->linkID[$linkNum]);

//使用UTF8存取数据库

mysql_query("SET NAMES '".C('DB_CHARSET')."'", $this->linkID[$linkNum]);

//设置 sql_model

if($dbVersion >'5.0.1'){

// mysql_query("SET sql_mode=''",$this->linkID[$linkNum]);

}

// 标记连接成功

$this->connected = true;

// 注销数据库连接配置信息

if(1 != C('DB_DEPLOY_TYPE')) unset($this->config);

}

return $this->linkID[$linkNum];

}

每次连接的时候,mycat日志都会出现如下:

2020-06-15 17:05:31.867 INFO [$_NIOREACTOR-3-RW] (io.mycat.net.handler.FrontendAuthenticator.success(FrontendAuthenticator.java:226)) - ServerConnection [id=17, schema=null, host=10.10.10.136, user=admin,txIsolation=3, autocommit=true, schema=null, executeSql=null]'admin' login success

2020-06-15 17:05:31.867 ERROR [$_NIOREACTOR-3-RW] (io.mycat.net.handler.FrontendCommandHandler.handle(FrontendCommandHandler.java:124)) - Unknown command:

020-06-15 17:05:31.868 ERROR [$_NIOREACTOR-3-RW] (io.mycat.net.FrontendConnection.writeErrMessage(FrontendConnection.java:210)) - ServerConnection [id=17, schema=test, host=10.10.10.136, user=admin,txIsolation=3, autocommit=true, schema=test, executeSql=null]Unknown commandjava.lang.Thread .getStackTrace1559

io.mycat.net.FrontendConnection .getStack224

io.mycat.net.FrontendConnection .writeErrMessage210

io.mycat.net.handler.FrontendCommandHandler .handle125

io.mycat.net.FrontendConnection .rawHandle570

io.mycat.net.FrontendConnection .handle552

io.mycat.net.AbstractConnection .onReadData327

io.mycat.net.NIOSocketWR .asynRead216

io.mycat.net.AbstractConnection .asynRead279

io.mycat.net.NIOReactor$RW .run113

java.lang.Thread .run748

write errorMsg:{} error

2020-06-15 17:05:31.884 INFO [$_NIOREACTOR-3-RW] (io.mycat.net.AbstractConnection.close(AbstractConnection.java:520)) - close connection,reason:quit cmd ,ServerConnection [id=17, schema=test, host=10.10.10.136, user=admin,txIsolation=3, autocommit=true, schema=test, executeSql=null]

求教一下为什么会有个执行sql为null的语句,上图的ERROR

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

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值