WordPress.org

Make WordPress Core

Opened 8 months ago

Last modified 3 months ago

#52496 new defect (bug)

Improve MySQL 8.0 support

Reported by: jrf Owned by:
Milestone: 5.9 Priority: normal
Severity: normal Version: 5.4
Component: Database Keywords: needs-patch
Focuses: Cc:

Description

While setting up the GH Action for the WP Importer plugin which runs the plugin integration tests (using the WP Core test framework) against various PHP/MySQL/WP combinations, I noticed a number of PHP/MySQL 8.0 combinations which error out during the running of the WP Core test bootstrap with errors which seem to indicate underlying incompatibilities with MySQL 8.0.

Relevant files in the Importer plugin setting up the test environment:

Test run showing the errors: https://github.com/WordPress/wordpress-importer/actions/runs/556887133

Errors reported:

PHP 5.6 / MySQL 8.0 / WP 5.5 and latest (5.6)
(Error line numbers are based on latest)

PHP Warning:  mysqli_real_connect(): Server sent charset (255) unknown to the client. Please, report to the developers in /tmp/wordpress/wp-includes/wp-db.php on line 1653
PHP Warning:  mysqli_real_connect(): (HY000/2054): Server sent charset unknown to the client. Please, report to the developers in /tmp/wordpress/wp-includes/wp-db.php on line 1653
PHP Warning:  mysql_connect(): Server sent charset (255) unknown to the client. Please, report to the developers in /tmp/wordpress/wp-includes/wp-db.php on line 1685
PHP Warning:  mysql_connect(): Server sent charset unknown to the client. Please, report to the developers in /tmp/wordpress/wp-includes/wp-db.php on line 1685

PHP 7.0 - 7.3 / MySQL 8.0 / WP latest (5.6)

PHP Warning:  mysqli_real_connect(): The server requested authentication method unknown to the client [caching_sha2_password] in /tmp/wordpress/wp-includes/wp-db.php on line 1653
PHP Warning:  mysqli_real_connect(): (HY000/2054): The server requested authentication method unknown to the client in /tmp/wordpress/wp-includes/wp-db.php on line 1653

Note: with the exact same setup, the PHP 7.4/8.0 - MySQL 8.0 - WP 5.6 test runs will pass.

Investigating needed

I haven't dug into the code. Reporting it here for further investigation.

I imagine that either the PHP/MySQL version check could be adjusted to indicate that MySQL 8.0 is only supported when running on PHP 7.4 or higher.

Alternatively, the underlying issues will need to be solved.

I also wonder if the WP Core tests in CI are being run against enough PHP/MySQL combinations, as I would imagine that these issues could have been discovered earlier if the above problem combinations would haved been used in WP Core CI.

Related: #49344 #51740

Change History (6)

#1 @jrf
8 months ago

  • Milestone changed from 5.7 to 5.8

Oops.. as it's very late in the 5.7 cycle, this should, of course, be addressed in the 5.8 development cycle, though any patches _may_ need to be backported to WP 5.4-5.7 patch releases.

#2 @SergeyBiryukov
8 months ago

Related: #49364, #51740.

Last edited 7 months ago by SergeyBiryukov (previous) (diff)

#3 @ayeshrajans
7 months ago

Re: PHP 7.0 - 7.3 / MySQL 8.0 / WP latest (5.6)

PHP <= 7.3 does not support caching_sha2_password, so it required --default-authentication-plugin=mysql_native_password at mysql process init, or changing the user authentication plugin to mysql_native_password for MySQL 8 to work. This should not a problem in PHP 7.4 with caching_sha2_password built-in. Related: https://php.watch/articles/PHP-7.4-MySQL-8-server-gone-away-fix.

In a CI setup using MySQL 8 + PHP 7.0..7.3, perhaps we can use an init option --default-authentication-plugin=mysql_native_password?

I'm not sure about the charset issue. My wild guess is that it's related to utf8mb4_0900_* class of collations only available in MySQL 8 and is the default now.

This ticket was mentioned in Slack in #core by chaion07. View the logs.


4 months ago

#5 @JeffPaul
4 months ago

  • Keywords needs-patch added
  • Milestone changed from 5.8 to Future Release

Given that 5.8 Beta 1 is a week away and no patch/PR exists on this ticket, I'm going to punt to Future Release. Once there's a patch/PR ready for this it can get added back to a numbered milestone.

#6 @desrosj
3 months ago

  • Milestone changed from Future Release to 5.9

I'd like to solve the MySQL 8 test failures for 5.9 to that we can look at expanding our testing combinations.

Note: See TracTickets for help on using tickets.