Mycat-Server icon indicating copy to clipboard operation
Mycat-Server copied to clipboard

1.6.6.1 connect with MySQL8,ERROR 1184 (HY000): Invalid DataSource:0

Open beamofsoul opened this issue 5 years ago • 32 comments

ENVIRONMENT:

MYSQL_VERSION=8.0.17-1debian9 MYCAT_VERSION=5.6.29-mycat-1.6.6.1-release-20181031195535 MyCat Server (OpenCloudDB)

CONFIGURATION:

schema.xml:

<?xml version="1.0"?>
<!DOCTYPE mycat:schema SYSTEM "schema.dtd">
<mycat:schema xmlns:mycat="http://io.mycat/">

        <schema name="test" checkSQLschema="false" sqlMaxLimit="100" dataNode="dn1"></schema>

        <dataNode name="dn1" dataHost="host1" database="test" />
        
        <dataHost name="host1" maxCon="1000" minCon="10" balance="1" writeType="0" dbType="mysql" dbDriver="native" switchType="1" slaveThreshold="100">
                
                <heartbeat>select user()</heartbeat>
                <writeHost host="hostMW" url="127.0.0.1:33061" user="root" password="root">
                        <readHost host="hostMR" url="127.0.0.1:33061" user="root" password="root" />
                </writeHost>

                <writeHost host="hostSW" url="127.0.0.1:33062" user="root" password="root" >
                        <readHost host="hostSR" url="127.0.0.1:33062" user="root" password="root" />
                </writeHost>

        </dataHost>

</mycat:schema>

server.xml:

<system>
	<property name="nonePasswordLogin">0</property>
	<property name="useHandshakeV10">1</property>
	<property name="useSqlStat">0</property>
	<property name="useGlobleTableCheck">0</property>
	<property name="sequnceHandlerType">2</property>
	<property name="subqueryRelationshipCheck">false</property>
	<property name="serverPort">8066</property>
	<property name="managerPort">9066</property> 
	<property name="handleDistributedTransactions">0</property>
	<property name="useOffHeapForMerge">1</property>
	<property name="memoryPageSize">64k</property>
	<property name="spillsFileBufferSize">1k</property>
	<property name="useStreamOutput">0</property>
	<property name="systemReserveMemorySize">384m</property>
	<property name="useZKSwitch">false</property>
</system>

<user name="root" defaultAccount="true">
		<property name="password">root</property>
		<property name="schemas">test</property>
</user>

<user name="repl">
		<property name="password">repl</property>
		<property name="schemas">test</property>
		<property name="readOnly">true</property>
</user>

ERROR:

[root@TEST-APP ~]# mysql -u root -p -P 8066 -h 47.*.*.*
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.6.29-mycat-1.6.6.1-release-20181031195535 MyCat Server (OpenCloudDB)

Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> use test;
Database changed
mysql> select 1;
ERROR 1184 (HY000): Invalid DataSource:0
mysql> 

DESCRIPTION:

I've connected both mysql servers using navicat 12, all going well. When tried to use mycat, the problem came up.

beamofsoul avatar Sep 05 '19 10:09 beamofsoul

mycat连不上mysql

junwen12221 avatar Sep 09 '19 05:09 junwen12221

尝试改一下mysql8的认证方式

junwen12221 avatar Sep 09 '19 05:09 junwen12221

@junwen12221 尝试使用mysql_native_password方式进行认证

在mysqld.conf中增加了最后一行来指定默认认证插件

[mysqld]
server-id=1
default-authentication-plugin=mysql_native_password

重启后,再次访问mycat,错误信息换成了ERROR 1184 (HY000): Invalid DataSource:1

[root@TEST-APP ~]# mysql -u root -p -P 8066 -h 47.*.*.*
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 21
Server version: 5.6.29-mycat-1.6.6.1-release-20181031195535 MyCat Server (OpenCloudDB)

Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> use test;
Database changed
mysql> select 1;
ERROR 1184 (HY000): Invalid DataSource:1
mysql> 

beamofsoul avatar Sep 17 '19 03:09 beamofsoul

我这里也遇到了同样的报错。 我的环境是mysql8.0.13+mycat1.6.7.1。 本次我从搭建成功mycat后就一直在报错,show tables返回 image

怀疑过是8.0密码认证改变引起的,但是之前的测试中没有遇到这样的问题。下面是我的配置文件

[root@MySQL05 mycat]# cat conf/schema.xml

<mycat:schema xmlns:mycat="http://io.mycat/"> <schema name="TESTDB" checkSQLschema="false" sqlMaxLimit="100" dataNode="dn1" /> <dataNode name="dn1" dataHost="localhost1" database="course" /> <dataHost name="localhost1" maxCon="10" minCon="1" balance="1" writeType="0" dbType="mysql" dbDriver="native" switchType="1" > select user() <writeHost host="master1" url="mysql01:3306" user="root" password="123456!"> <readHost host="slave1" url="mysql03:3306" user="root" password="123456!" /> </writeHost> </dataHost> </mycat:schema>

[root@MySQL05 mycat]# cat conf/server.xml ..................................................................................................................................... ....................................................................................................................................... ........................................................................................................................................ <user name="root" defaultAccount="true"> 123456 TESTDB

	<!-- 表级 DML 权限设置 -->
	<!-- 		
	<privileges check="false">
		<schema name="TESTDB" 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">TESTDB</property>
	<property name="readOnly">true</property>
</user>

</mycat:server>

guanhua-dba avatar Mar 16 '20 07:03 guanhua-dba

奇怪的问题频出,例如,stop mycat时提示没有运行,但是我查看mycat是运行的。 image

guanhua-dba avatar Mar 16 '20 07:03 guanhua-dba

你在连接mycat时应该使用这样的方式: mysql -h 127.0.0.1 -u root -P 8066 --default-auth=mysql_native_password -p

关于您提到的问题,我解决了,但是我不知道您的问题是否和我的一样,所以您通过这个命令看一下mycat的运行日志 cat mycat-03-16-1.log|grep error。将报错提供一下,我看看是否和我的一样。

guanhua-dba avatar Mar 16 '20 09:03 guanhua-dba

Invalid DataSource:0 这个问题最后都是如何解决的

aslzl avatar May 28 '20 06:05 aslzl

您好,您将github上的链接发我一下。

在 2020年5月28日,14:12,aslzl <[email protected]mailto:[email protected]> 写道:

Invalid DataSource:0 这个问题最后都是如何解决的

— You are receiving this because you commented. Reply to this email directly, view it on GitHubhttps://github.com/MyCATApache/Mycat-Server/issues/2303#issuecomment-635128007, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AODOS52QP5YH5IKTNCOQHK3RTX6FNANCNFSM4IT4CQPQ.

guanhua-dba avatar May 28 '20 06:05 guanhua-dba

非常感谢,这个问题困扰我将近两天了,这是我的邮箱 [email protected] @guanhua-dba

aslzl avatar May 28 '20 11:05 aslzl

请问解决了嘛我的也是mysql8.0遇到了这个问题

BryantJames avatar Aug 10 '20 05:08 BryantJames

@guanhua-dba 同求。这个错误如何解决的??谢谢! [email protected]

699640 avatar Aug 30 '20 06:08 699640

请告知一下mycat和mysql版本号

guanhua-dba avatar Aug 30 '20 09:08 guanhua-dba

请告知一下mycat和mysql版本号

guanhua-dba avatar Aug 30 '20 09:08 guanhua-dba

请告知一下mycat和mysql版本号

guanhua-dba avatar Aug 30 '20 09:08 guanhua-dba

请告知一下mycat和mysql版本号

guanhua-dba avatar Aug 30 '20 09:08 guanhua-dba

请告知一下mycat和mysql版本号

guanhua-dba avatar Aug 30 '20 09:08 guanhua-dba

非常感谢,这个问题困扰我将近两天了,这是我的邮箱 [email protected] @guanhua-dba

最后是怎么解决的。 [email protected]

mainlove avatar Apr 08 '21 12:04 mainlove

您好,麻烦告诉一下MyCAT、MySQL使用的版本,以及MyCAT机器上使用的MySQL的环境,最后是 连接的命令提供一下。

guanhua-dba avatar Apr 12 '21 06:04 guanhua-dba

你好,我这个问题后来解决了。我上次就回复你了。

------------------ 原始邮件 ------------------ 发件人: @.>; 发送时间: 2021年4月12日(星期一) 下午2:47 收件人: @.>; 抄送: @.>; @.>; 主题: Re: [MyCATApache/Mycat-Server] 1.6.6.1 connect with MySQL8,ERROR 1184 (HY000): Invalid DataSource:0 (#2303)

您好,麻烦告诉一下MyCAT、MySQL使用的版本,以及MyCAT机器上使用的MySQL的环境,最后是 连接的命令提供一下。

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe.

699640 avatar Apr 12 '21 06:04 699640

抱歉,刚刚用的是全部回复,打扰您了。

699640 @.***> 于2021年4月12日周一 下午2:50写道:

你好,我这个问题后来解决了。我上次就回复你了。

------------------ 原始邮件 ------------------ 发件人: @.>; 发送时间: 2021年4月12日(星期一) 下午2:47 收件人: @.>; 抄送: @.>; @.>; 主题: Re: [MyCATApache/Mycat-Server] 1.6.6.1 connect with MySQL8,ERROR 1184 (HY000): Invalid DataSource:0 (#2303)

您好,麻烦告诉一下MyCAT、MySQL使用的版本,以及MyCAT机器上使用的MySQL的环境,最后是 连接的命令提供一下。

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/MyCATApache/Mycat-Server/issues/2303#issuecomment-817535575, or unsubscribe https://github.com/notifications/unsubscribe-auth/AODOS5YE65TVHJC6HN2SH3DTIKJ3LANCNFSM4IT4CQPQ .

guanhua-dba avatar Apr 12 '21 09:04 guanhua-dba

您好,请问怎么解决的,我也是这个问题

ovenfrank avatar Aug 09 '22 10:08 ovenfrank

您好,请问怎么解决的,我也是这个问题,邮箱:[email protected]

ovenfrank avatar Aug 09 '22 10:08 ovenfrank

报这个错是数据源链接补上,issue里面找下修改mysql8的密码格式;新人建议直接使用mycat2

zwyqz avatar Aug 09 '22 10:08 zwyqz

用这种方式启动也不行:--default-auth=mysql_native_password my.cnf也改了密码加密方式

ovenfrank avatar Aug 09 '22 11:08 ovenfrank

这么多人问,就没个解决方案吗

ovenfrank avatar Aug 09 '22 15:08 ovenfrank