Get the App
SLTechnology News&Howtos  ›  Database  › 

The solution of error reporting in the process of Mycat Integration MySQL

Shulou Source: shulou.com Published: 2022-06-01 17:33:55 09月17日 Update

What should I do if I report an error in the process of Mycat integrating MySQL? This problem may be often seen in our daily study or work. Through this question, I hope you can gain more. Here are the steps to solve this problem.

Download the driver for version 8.x

First, you need to download the 8.x version of the driver. The default MySQL driver for Mycat is 5.x. Copy the download address of the 8.x driver jar package on the maven central warehouse, and then download it on Linux using the wget command:

[root@txy-server ~] # cd / usr/local/src [root@txy-server / usr/local/src] # wget https://repo1.maven.org/maven2/mysql/mysql-connector-java/8.0.18/mysql-connector-java-8.0.18.jar

Move the driver package to the lib directory of mycat and delete the original 5.x driver package:

[root@txy-server / usr/local/src] # mv mysql-connector-java-8.0.18.jar / usr/local/mycat/lib/ [root@txy-server / usr/local/src] # rm-rf / usr/local/mycat/lib/mysql-connector-java-5.1.35.jar

Then use the chmod command to set the permissions for the driver package:

[root@txy-server / usr/local/mycat] # chmod 777 lib/mysql-connector-java-8.0.18.jar modify schema.xml

Modify the schema.xml configuration file located in the conf directory in order to change how Mycat connects to MySQL:

[root@txy-server / usr/local/mycat] # vim conf/schema.xml

Change the dbDriver attribute in the dataHost tag to jdbc, and modify the url attribute in the writeHost tag:

Select user () modifies server.xml

Modify the server.xml configuration file located in the conf directory:

[root@txy-server / usr/local/mycat] # vim conf/server.xml

Set useHandshakeV10 to 1. If you don't have the tag, you can add it:

1... Restart Mycat and test

Restart Mycat:

[root@txy-server / usr/local/mycat] # mycat stopStopping Mycat-server...Stopped Mycat-server. [root@txy-server / usr/local/mycat] # mycat startStarting Mycat-server... [root@txy-server / usr/local/mycat] #

Another problem was encountered when testing whether to connect to Mycat properly. Using the client tool of MySQL 8.x to connect to Mycat, a password error was reported:

[root@txy-server] # mysql-uroot-p-P9066-h227.0.0.1Enter password: ERROR 1045 (HY000): Access denied for user 'root', because password is error [root@txy-server ~] #

Again, this is because versions above MySQL 8 do not encrypt passwords in the same way as previous versions. At present, Mycat only supports 5.x encryption, so a password error will be reported when connecting to Mycat using version 8 or above of the MySQL client tool.

There are two main solutions, one is to specify the encryption method when the mysql client connects. The following is an example:

[root@txy-server] # mysql-uroot-p-P9066-h227.0.0.1-- default-auth=mysql_native_password

The second is to use the 5.x version of the MySQL client tool to connect to Mycat. The following is an example:

[root@txy-server / usr/local/mysql-5.7.28] # bin/mysql-uroot-p-P9066-h227.0.0.1

After reading this article, can you solve the problem of error reporting in the process of Mycat integration MySQL independently? If you want to learn more skills or want to know more about it, you are welcome to follow the industry information channel. Thank you for reading.

Tags: Versions drivers methods problems customers clients passwords tools more tags directories encryption procedures integration content commands properties files examples errors Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Xiaomi Microsoft Shulou Tech Info macOS Linux