简体   繁体   English

在my.cnf中具有多种数据库编码的MySQL

[英]MySQL with multiple database encodings in my.cnf

I have a database set up to use the encoding UTF-8 multibyte-4 . 我有一个数据库设置为使用encoding UTF-8 multibyte-4 This is configured in the my.cnf file: 这是在my.cnf文件中配置的:

[client]
default-character-set = utf8mb4

[mysql]
default-character-set = utf8mb4

(...)

character-set-server            = utf8mb4
collation-server                = utf8mb4_unicode_ci

I would like to add a 2nd database, let's call them DB1 and DB2 . 我想添加第二个数据库,我们称它们为DB1DB2

The problem: The application that uses this 2nd database DB2 cannot work with the encoding I have configured in my.cnf . 问题:使用第二数据库DB2的应用程序无法使用我在my.cnf配置的编码。 It's a 3rd party application, so I have no possibility to change something, all I can do is modify the databse setup. 这是一个第三方应用程序,因此我无法更改任何东西,我所能做的就是修改数据库设置。

If I comment the above lines in my.cnf , the 3rd party application works, I guess it's using plain UTF-8 encoding . 如果我在my.cnf注释以上各行,则第三方应用程序有效,我想它正在使用普通的UTF-8 encoding But now the system using the 1st database DB1 fails on encoding. 但是现在使用第一个数据库DB1的系统无法编码。

Is there a way to specify a default encoding in my.cnf for each database, separating DB1 encoding from DB2 ? 有没有一种方法可以在my.cnf为每个数据库指定默认编码,从而将DB1编码与DB2分开? Searching the internet has not shown me any solution other than using a separate/2nd MySQL installation. 除了使用单独的第2个MySQL安装之外,在互联网上搜索没有给我任何解决方案。

Using MySQL version 5.6.x 使用MySQL version 5.6.x

Any hints are greatly appreciated. 任何提示,不胜感激。

  1. Shoot that 3rd party software. 拍摄该第三方软件。

  2. Have utf8 in my.cnf. 在my.cnf中拥有utf8。 Perform SET NAMES utf8mb4; 执行SET NAMES utf8mb4; in that applications that need it and that you can get to. 在需要它的应用程序中并且您可以找到它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM