Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What are the troubles that MySQL 8.0 brings to the development direction?

2025-04-02 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)05/31 Report--

This article mainly explains "what are the troubles caused by MySQL 8.0 to the development direction". The content in the article is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn "what are the troubles caused by MySQL 8.0 to the development direction?"

1: password policy plug-in

MySQL 8.0 started using caching_sha2_password as the default authentication plug-in. If you upgrade the database to version 8.0, it is not friendly to the application jdbc driver compatibility, and the fastest way to make the application run needs to change the default caching_sha2_password to the previous mysql_native_password.

For example:

ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY' password'

You can also set it in the parameters, modify the my.cnf, and restart the service to take effect:

Default_authentication_plugin=mysql_native_password

2.JDBC driver change

If you upgrade from MySQL5.5 to 5.7, don't worry about the driver, but when you get to 8.0, you need to pay special attention to the JDBC driver, otherwise you may have the following error.

Loading class `com.mysql.jdbc.Driver'. This is deprecated. The new driver class is `com.mysql.cj.jdbc.Driver'. The driver is automatically registered via the SPI and manual loading of the driver class is generally unnecessary.

For JDBC's url, there will be the following changes:

String Url= "jdbc:mysql://211.159.xxx:33071/maxwell_test?useUnicode=true&characterEncoding=utf-8"

It needs to be adjusted to the following format:

String Url= "jdbc:mysql://211.159.xxx:33071/maxwell_test?useUnicode=true&characterEncoding=utf-8&useSSL=false&&serverTimezone=GMT"

The corresponding load driver requires

Class.forName ("com.mysql.jdbc.Driver")

Modified to:

Class.forName ("com.mysql.cj.jdbc.Driver")

3. Length warning for integer types

For example, the following table structure, exported by tools such as workbench, is similar in format, but will give an alarm when executed in 8.0.

CREATE TABLE `data_payment_history_ test` (`id` bigint (20) unsigned NOT NULL AUTO_INCREMENT COMMENT 'self-added ID', `pid` int (11) unsigned NOT NULL DEFAULT' 0' COMMENT 'user ID',. `cdate`datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT 'creation time',. PRIMARY KEY (`id`), KEY `idx_credit_overdraw_history__ pid` (`pid`) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COMMENT=' payment record'

Two warnings are mainly involved here, one is a length warning of an integer type, and the other is a character set warning

In terms of expansion, the length warning message of the integer type is: Integer display width is deprecated and will be removed in a future, which means that int (11) is out of date and should be written directly as int,bigint

As for the character set configuration, the default is utf8mb4 in MySQL8.0. If we manually write the utf8 type, we will prompt: 'utf8' is currently an alias for the character set UTF8MB3, but will be an alias for UTF8MB4 in a future release. Please consider using UTF8MB4 in order to be unambiguous.

Of course, if you set the global character set to utf8, then without warning, the character set is still utf8.

4.windows installation version

The installation version of windows has always provided 32-bit, which is a problem left over from history. If some students click directly for convenience, it may be embarrassing to deploy the online environment as 32-bit. Oracle's windows version takes the opposite approach and has abandoned the 32-bit version directly a long time ago.

Thank you for your reading, the above is the content of "what are the troubles brought by MySQL 8.0 to the development direction?" after the study of this article, I believe you have a deeper understanding of what the troubles brought to the development direction by MySQL 8.0. the specific use of the situation still needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report