Mycat1.6.7连接Mysql8
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Mycat1.6.7连接Mysql8相关的知识,希望对你有一定的参考价值。
Mycat1.6.7是Mycat几年前的版本了,默认只兼容mysql5.7和支持java8,而我昨晚没发现这些问题,悲剧开始了,因为我的window有几个jdk版本,jdk17覆盖了jdk8,不行,后面换到虚拟机里面,因为连接的Mysql8也连不上,后面修改配置,才最终连接成功,因此记录一下
这是数据库截图
修改conf的schema.xml
<?xml version="1.0"?>
<!DOCTYPE mycat:schema SYSTEM "schema.dtd">
<mycat:schema xmlns:mycat="http://io.mycat/">
<schema name="TESTDB" checkSQLschema="true" sqlMaxLimit="100">
<!-- auto sharding by id (long) -->
<table name="Item_detail" primaryKey="item_id" autoIncrement="true" dataNode="dn1,dn2" rule="mod_rule" />
</schema>
<dataNode name="dn1" dataHost="localhost1" database="User_Info" />
<dataNode name="dn2" dataHost="localhost2" database="User_Info" />
<dataHost name="localhost1" maxCon="1000" minCon="10" balance="1"
writeType="0" dbType="mysql" dbDriver="jdbc" switchType="1" slaveThreshold="100">
<heartbeat>select 1</heartbeat>
<!-- can have multi write hosts -->
<writeHost host="hostM1" url="jdbc:mysql://hadoop101:3306?useSSL=false&useUnicode=true&characterEncoding=UTF8&serverTimezone=UTC" user="root" password="12345678" />
</dataHost>
<!--dbDriver修改为jdbc-->
<dataHost name="localhost2" maxCon="1000" minCon="10" balance="1"
writeType="0" dbType="mysql" dbDriver="jdbc" switchType="1" slaveThreshold="100">
<heartbeat>select 1</heartbeat>
<!-- can have multi write hosts -->
<writeHost host="hostM2" url="jdbc:mysql://192.168.154.59:3309?useSSL=false&useUnicode=true&characterEncoding=UTF8&serverTimezone=UTC" user="root" password="root" />
</dataHost>
</mycat:schema>
修改server.xml
<property name="useHandshakeV10">1</property>
<property name="defaultSqlParser">druidparser</property>
替换lib的mysql驱动包
连接
提示
conf下的rule.xml有切片个数的配置
以上是关于Mycat1.6.7连接Mysql8的主要内容,如果未能解决你的问题,请参考以下文章
solr配置DataImport连接MySQL8数据库注意:
NativeForMySQL 连接MySQL8 提示:1251- Client does not support authentication protocol