报错: schema DEMO,demo522_sub1 refered by user root is not exist!
问题描述:
报错: schema DEMO,demo522_sub1 refered by user root is not exist!在navicat中A1,B1节点创建了这两个数据库,对比了schema.xml与server.xml,没找到问题,百度有人说可能要大写,我还没试(课程没强调要大写,而且有数字),该怎么解决这个问题呢
相关代码:
<user name="root" defaultAccount="true">
<property name="password">abc123456</property>
<property name="schemas">DEMO,demo522_sub1,demo522_sub2</property>
<property name="defaultSchema">DEMO</property>
<!--No MyCAT Database selected 错误前会尝试使用该schema作为schema,不设置则为null,报错 -->
<!-- 表级 DML 权限设置 -->
<!--
<privileges check="false">
<schema name="DEMO" dml="0110" >
<table name="tb01" dml="0000"></table>
<table name="tb02" dml="1111"></table>
</schema>
</privileges>
-->
</user>
<user name="user">
<property name="password">user</property>
<property name="schemas">DEMO,demo522_sub1,demo522_sub2</property>
<property name="readOnly">true</property>
<property name="defaultSchema">DEMO</property>
</user>
相关代码:
<?xml version="1.0"?>
<!DOCTYPE mycat:schema SYSTEM "schema.dtd">
<mycat:schema xmlns:mycat="http://io.mycat/">
<!--配置路由逻辑库可以向哪些数据表转发SQL语句-->
<schema name="DEMO" checkSQLschema="true" sqlMaxLimit="100" randomDataNode="dn1">
<table name="tb_emp" primaryKey="id" dataNode="dn1,dn2" type="global"/>
<table name="tb_customer" primaryKey="id" dataNode="dn1,dn2" rule="mod-long" autoIncrement="true">
<childTable name="tb_order" primaryKey="id" joinKey="customer_id" parentKey="id" autoIncrement="true"/>
</table>
<table name="tb_checkin" primaryKey="id" dataNode="dn1,dn2" rule="tb_checkin.range_rule"/>
<table name="tb_coupon" primaryKey="id" dataNode="dn1,dn2" rule="tb_coupon_rule"/>
<table name="tb_driver" primaryKey="id" dataNode="dn1,dn2" rule="city_rule"/>
<table name="tb_leave" primaryKey="id" dataNode="dn1,dn2" rule="10day_rule"/>
</schema>
<schema name="demo522_sub1" checkSQLschema="true" sqlMaxLimit="100" randomDataNode="sub1_dn1">
<table name="undo_log" primaryKey="id" dataNode="sub1_dn1,sub1_dn2" type="global"/>
<table name="tb_student" primaryKey="id" dataNode="sub1_dn1,sub1_dn2" rule="mod-long" autoIncrement="true"/>
</schema>
<schema name="demo522_sub2" checkSQLschema="true" sqlMaxLimit="100" randomDataNode="sub2_dn1">
<table name="undo_log" primaryKey="id" dataNode="sub2_dn1,sub2_dn2" type="global"/>
<table name="tb_card" primaryKey="id" dataNode="sub2_dn1,sub2_dn2" rule="mod-long" autoIncrement="true"/>
</schema>
<!--使用A分片数据源中的哪个逻辑库-->
<dataNode name="dn1" dataHost="A" database="DEMO" />
<!--使用B分片数据源中的哪个逻辑库-->
<dataNode name="dn2" dataHost="B" database="DEMO" />
<dataNode name="sub1_dn1" dataHost="A" database="demo522_sub1" />
<dataNode name="sub1_dn2" dataHost="B" database="demo522_sub1" />
<dataNode name="sub2_dn1" dataHost="A" database="demo522_sub2" />
<dataNode name="sub2_dn2" dataHost="B" database="demo522_sub2" />
<!--配置A分片的数据源连接-->
<dataHost name="A" maxCon="1000" minCon="10" balance="1" writeType="0"
dbType="mysql" dbDriver="native" switchType="1" slaveThreshold="100">
<heartbeat>select 1</heartbeat>
<writeHost host="w1" url="172.18.0.7:3306" user="root" password="abc123456">
<readHost host="w1r1" url="172.18.0.8:3306" user="root" password="abc123456"/>
<readHost host="w1r2" url="172.18.0.9:3306" user="root" password="abc123456"/>
</writeHost>
<writeHost host="w2" url="172.18.0.10:3306" user="root" password="abc123456">
<readHost host="w2r1" url="172.18.0.11:3306" user="root" password="abc123456"/>
<readHost host="w2r2" url="172.18.0.12:3306" user="root" password="abc123456"/>
</writeHost>
</dataHost>
<!--配置B分片的数据源连接-->
<dataHost name="B" maxCon="1000" minCon="10" balance="1" writeType="0"
dbType="mysql" dbDriver="native" switchType="1" slaveThreshold="100">
<heartbeat>select 1</heartbeat>
<writeHost host="w1" url="172.18.0.13:3306" user="root" password="abc123456">
<readHost host="w1r1" url="172.18.0.14:3306" user="root" password="abc123456"/>
<readHost host="w1r2" url="172.18.0.15:3306" user="root" password="abc123456"/>
</writeHost>
<writeHost host="w2" url="172.18.0.16:3306" user="root" password="abc123456">
<readHost host="w2r1" url="172.18.0.17:3306" user="root" password="abc123456"/>
<readHost host="w2r2" url="172.18.0.18:3306" user="root" password="abc123456"/>
</writeHost>
</dataHost>
</mycat:schema>
相关截图:
相关截图:
相关截图:
29
收起
正在回答 回答被采纳积分+1
1回答
Java工程师 2024版
- 参与学习 2052 人
- 提交作业 1500 份
- 解答问题 1324 个
2024重磅革新,超百小时内容豪华升级,加速提升高级技能与高薪就业竞争力 课程紧贴企业最新人才需求,历经7年持续迭代,帮助万名学子入行转行 从零起点到高阶实战,学习路径稳健顺滑,成就从小白到工程师高薪
了解课程





恭喜解决一个难题,获得1积分~
来为老师/同学的回答评分吧
0 星