Bug #93450 mysqldump does not wrap SET NAMES into mysql-extension comment
Submitted: 3 Dec 2018 13:20 Modified: 4 Dec 2018 4:00
Reporter: Mattias Jonsson (OCA) Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: mysqldump Command-line Client Severity:S3 (Non-critical)
Version:8.0, 8.0.13 OS:Any
Assigned to: CPU Architecture:Any

[3 Dec 2018 13:20] Mattias Jonsson
Description:
In WL#10353 there was a change in the output of mysqldump, no longer wrapping SET NAMES in an mysql-extension comment, breaking its compatibility with other imports (like vitess).

Commit with changes (including result files) that:
https://github.com/mysql/mysql-server/commit/ebaff9fffc958030a57d8ea7f1f2d527cac1df64

I cannot see any reason or comments on why the the wrapping was removed.

How to repeat:
See: https://github.com/mysql/mysql-server/commit/ebaff9fffc958030a57d8ea7f1f2d527cac1df64#diff...

Where it is clear that:
/*!40101 SET character_set_client = utf8 */;
was changed to:
 SET character_set_client = utf8mb4 ;
without any mysql-extension comment protecting it from being parsed by a non mysql-extension aware parser.

Suggested fix:
Wrap the 'SET NAMES = <character_set>' command in mysqldump like:
/*50503 SET NAMES = utf8mb4 */;

So non mysql-extension aware parsers can still parse the dump.
I assume utf8mb4 was added by 5.5.3:
https://dev.mysql.com/doc/relnotes/mysql/5.5/en/news-5-5-3.html
[4 Dec 2018 4:00] Umesh Shastry
Hello Mattias,

Thank you for the report and feedback!

regards,
Umesh