Mycat connected to Precautions 8:00 of MySQL

First, the problem

MyCat is an open source distributed middleware based MySQl protocol, the core is sub-library sub-table.

But now MyCat still the main face of MySQL 5.5, 5.6, version 5.7, the latest of MySQL 8 is not fully supported, the user needs a series of modifications to the MySQL 8 and MyCat configuration.

According to their test results, a brief summary of these changes.

Second, on the MySql 8

Mysql mainly modify the configuration file in the Windows platform is my.ini, in linux platform is my.cnf:

  • Modify the default encryption method: After installing MySQL 8, need to modify the default encryption method is mysql_native_password, in order to maintain compatibility with version 5.x.
  • If the Linux platform, set up before the first start lower_case_table_names = 1 (table names are case-insensitive), note that once the data already in the database, and then start mysql so settings can cause failure.
  • To prevent a mismatch character set, also preferably explicitly set the character set (optional).

The following is a my.cnf I use:

[mysqld]
...
default-authentication-plugin=mysql_native_password
lower_case_table_names=1
character-set-server=utf8

[mysql]
default-character-set=utf8

Third, on the MyCat

Mainly it involves three aspects.

  • Log Logic library

The traditional way Mycat login logic library is: mysql -uroot -p -h127.0.0.1 -P8066 -DTESTDB

But for MySql 8, will be reported password wrong way, this is due to the default encryption Mysql 8 has been changed caching_sha2_password, and MyCat this is not yet supported. To do this, add --default_auth = mysql_native_pasowrd options:

mysql -uroot -p -h127.0.0.1 -P8066 -DTESTDB --default_auth=mysql_native_pasowrd

In order to successfully log logical library.

  • Alternatively comes JDBC driver jar

http://central.maven.org/maven2/mysql/mysql-connector-java/8.0.11/ mysql-connector-java-8.0.11.jar

  • When the modified url jdbc

If the dataHost driverType as the JDBC, also need to modify the url, increase useSSL = false and serverTimezone = UTC options options need to add characterEncoding = utf8 (optional) In some cases, for example:

url="jdbc:mysql://192.168.64.187:3306?useSSL=false&serverTimezone=UTC& characterEncoding=utf8"

Fourth, other

In the previous experiment, using JDBC connection myCat like PostgreSQL database found two sub-table can not be achieved automatically slice. But for the automatic sheet MySql 8, two sub-table is normal, there is no problem.

Guess you like

Origin www.linuxidc.com/Linux/2019-07/159593.htm