MySQL 5.7.7排序规则'hebrew_general_ci'不适用于字符集'utf8'

时间:2022-09-01 08:58:15

Problem summary: Can't open MySQL 5.7.7 with the following variables:

问题总结:无法使用以下变量打开MySQL 5.7.7:

character_set_client    hebrew
character_set_connection    hebrew
character_set_database  hebrew
character_set_filesystem    hebrew
character_set_results   hebrew
character_set_server    hebrew
character_set_system    hebrew
character_sets_dir  C:\Program Files\MySQL\MySQL Server 5.7\share\charsets\

What the MYSQL 5.7.7 writes: 'hebrew_general_ci' is not valid for character set 'utf8'

MYSQL 5.7.7所写的:'hebrew_general_ci'对字符集'utf8'无效

What do I get:

我得到了什么:

character_set_client    utf8
character_set_connection    utf8
character_set_database  utf8
character_set_filesystem    binary
character_set_results   utf8
character_set_server    utf8
character_set_system    utf8
character_sets_dir  C:\Program Files\MySQL\MySQL Server 5.7\share\charsets\

Software: MySQL 5.7.7

软件:MySQL 5.7.7

Operating system: WIN 7 64-bit

操作系统:win7 64位

What did i do: 1. Changed all data in C:\ProgramData\MySQL\MySQL Server 5.7\My.ini configuration file to:

我做了什么:1。改变了所有的数据在C:\程序数据\MySQL\MySQL服务器5.7\My。ini配置文件:

[client]
no-beep
default-character-set = hebrew

[mysql]

default-character-set=hebrew

[mysqld]

init_connect='SET collation_connection = hebrew_general_ci'
character-set-server = hebrew
collation-server = hebrew_general_ci
init-connect='SET NAMES hebrew'
init_connect='SET collation_connection = hebrew_general_ci' 

2. Ran the server from cmd with:

2。从cmd运行服务器:

mysqld --defaults-file="C:\ProgramData\MySQL\MySQL Server 5.7\my.ini"  

3. got the error message when running the server from CMD

3所示。从CMD运行服务器时获取错误消息

MySQL 5.7.7 collation 'hebrew_general_ci' is not valid for character set 'utf8'

**4. The main issue is that any change in configuration is not occuring **

* * 4。主要问题是没有发生任何配置更改**

2 个解决方案

#1


1  

The HEX for Alef in CHARACTER SET hebrew is F0; in utf8, it is D790. Check the hex in your application language to see which you have. Then do SET NAMES to hebrew or utf8 accordingly.

用于Alef的字符集希伯来语是F0;在utf8中,它是D790。检查您的应用程序语言中的十六进制,看看您有哪些。然后将名称设置为希伯来语或utf8。

mysql> SET NAMES hebrew;
Query OK, 0 rows affected (0.00 sec)

mysql> SHOW VARIABLES LIKE 'char%';
+--------------------------+-----------------------------------------------+
| Variable_name            | Value                                         |
+--------------------------+-----------------------------------------------+
| character_set_client     | hebrew                                        |
| character_set_connection | hebrew                                        |
| character_set_database   | latin1                                        |
| character_set_filesystem | binary                                        |
| character_set_results    | hebrew                                        |
| character_set_server     | utf8                                          |
| character_set_system     | utf8                                          |
| character_sets_dir       | c:\wamp\bin\mysql\mysql5.6.12\share\charsets\ |
+--------------------------+-----------------------------------------------+
8 rows in set (0.00 sec)

Notice how SET NAMES modifies only 3 of the entries. It is dangerous to modify any of the others. Recommend you not change the others.

注意,SET名称如何只修改3个条目。修改其他的是危险的。建议你不要改变其他的。

SET NAMES declares to mysql what the encoding is in your client. The encoding in the table can be different. In particular, since you seem to want hebrew_general_ci, the only way to get it (or equivalent, since there seems not to be a utf8_hebrew_ci) is to declare you columns to be CHARACTER SET hebrew COLLATION hebrew_general_ci. Keep in mind that this setting is independent of the enocoding in the client; SET NAMES handles conversion if needed.

设置名称向mysql声明客户机中的编码。表中的编码可以是不同的。特别是,由于您似乎希望使用hebrew_general_ci,因此获得它的唯一方法(或等效的,因为似乎没有utf8_hebrew_ci)是将列声明为字符集hebrew_general_ci。请记住,此设置独立于客户机中的enocoding;如果需要,设置名称将处理转换。

If the application involves a web page, the meta tag needs to include the client's character set.

如果应用程序涉及web页面,元标记需要包含客户端的字符集。

When connecting as root, init_connect (in my.ini) is skipped. Hence, you may find confusing results; avoid being root (or any SUPER user).

当以root身份连接时,跳过init_connect(在my.ini中)。因此,您可能会发现令人困惑的结果;避免成为根(或任何超级用户)。

This collation chart specifies what happens in hebrew_general_ci; it may not be anything special. My point is -- utf8 with utf8_general_ci may give you identical results.

这个排序图指定了在hebrew_general_ci中发生的事情;这可能没什么特别的。我的观点是——使用utf8_general_ci的utf8可能会得到相同的结果。

#2


0  

Thanks for your fast and informative reply. My application for reading MySQL Tables is SAS9.4. Actually, I'm trying to read the MySQL tables via SAS\ACCESS Interface to MySQL.

谢谢你快速而详尽的回复。我读取MySQL表的应用程序是SAS9.4。实际上,我正在尝试通过SAS\ACCESS接口读取MySQL表。

After a bit of research, I've changed my SAS cfg file (C:\Program Files\SASHome\SASFoundation\9.4\sasv9.cfg)

经过一些研究,我已经更改了我的SAS cfg文件(C:\程序文件SASHome\SASFoundation\9.4\sasv9.cfg)

From: -config "C:\Program Files\SASHome\SASFoundation\9.4\nls\en\sasv9.cfg"
To: -config "C:\Program Files\SASHome\SASFoundation\9.4\nls\u8\sasv9.cfg"

Now both of the applications "talk" utf8.

现在这两个应用程序都“talk”utf8。

That solved the issue... :)

解决了问题……:)

Thanks a lot!!

非常感谢! !

Daniel

丹尼尔

#1


1  

The HEX for Alef in CHARACTER SET hebrew is F0; in utf8, it is D790. Check the hex in your application language to see which you have. Then do SET NAMES to hebrew or utf8 accordingly.

用于Alef的字符集希伯来语是F0;在utf8中,它是D790。检查您的应用程序语言中的十六进制,看看您有哪些。然后将名称设置为希伯来语或utf8。

mysql> SET NAMES hebrew;
Query OK, 0 rows affected (0.00 sec)

mysql> SHOW VARIABLES LIKE 'char%';
+--------------------------+-----------------------------------------------+
| Variable_name            | Value                                         |
+--------------------------+-----------------------------------------------+
| character_set_client     | hebrew                                        |
| character_set_connection | hebrew                                        |
| character_set_database   | latin1                                        |
| character_set_filesystem | binary                                        |
| character_set_results    | hebrew                                        |
| character_set_server     | utf8                                          |
| character_set_system     | utf8                                          |
| character_sets_dir       | c:\wamp\bin\mysql\mysql5.6.12\share\charsets\ |
+--------------------------+-----------------------------------------------+
8 rows in set (0.00 sec)

Notice how SET NAMES modifies only 3 of the entries. It is dangerous to modify any of the others. Recommend you not change the others.

注意,SET名称如何只修改3个条目。修改其他的是危险的。建议你不要改变其他的。

SET NAMES declares to mysql what the encoding is in your client. The encoding in the table can be different. In particular, since you seem to want hebrew_general_ci, the only way to get it (or equivalent, since there seems not to be a utf8_hebrew_ci) is to declare you columns to be CHARACTER SET hebrew COLLATION hebrew_general_ci. Keep in mind that this setting is independent of the enocoding in the client; SET NAMES handles conversion if needed.

设置名称向mysql声明客户机中的编码。表中的编码可以是不同的。特别是,由于您似乎希望使用hebrew_general_ci,因此获得它的唯一方法(或等效的,因为似乎没有utf8_hebrew_ci)是将列声明为字符集hebrew_general_ci。请记住,此设置独立于客户机中的enocoding;如果需要,设置名称将处理转换。

If the application involves a web page, the meta tag needs to include the client's character set.

如果应用程序涉及web页面,元标记需要包含客户端的字符集。

When connecting as root, init_connect (in my.ini) is skipped. Hence, you may find confusing results; avoid being root (or any SUPER user).

当以root身份连接时,跳过init_connect(在my.ini中)。因此,您可能会发现令人困惑的结果;避免成为根(或任何超级用户)。

This collation chart specifies what happens in hebrew_general_ci; it may not be anything special. My point is -- utf8 with utf8_general_ci may give you identical results.

这个排序图指定了在hebrew_general_ci中发生的事情;这可能没什么特别的。我的观点是——使用utf8_general_ci的utf8可能会得到相同的结果。

#2


0  

Thanks for your fast and informative reply. My application for reading MySQL Tables is SAS9.4. Actually, I'm trying to read the MySQL tables via SAS\ACCESS Interface to MySQL.

谢谢你快速而详尽的回复。我读取MySQL表的应用程序是SAS9.4。实际上,我正在尝试通过SAS\ACCESS接口读取MySQL表。

After a bit of research, I've changed my SAS cfg file (C:\Program Files\SASHome\SASFoundation\9.4\sasv9.cfg)

经过一些研究,我已经更改了我的SAS cfg文件(C:\程序文件SASHome\SASFoundation\9.4\sasv9.cfg)

From: -config "C:\Program Files\SASHome\SASFoundation\9.4\nls\en\sasv9.cfg"
To: -config "C:\Program Files\SASHome\SASFoundation\9.4\nls\u8\sasv9.cfg"

Now both of the applications "talk" utf8.

现在这两个应用程序都“talk”utf8。

That solved the issue... :)

解决了问题……:)

Thanks a lot!!

非常感谢! !

Daniel

丹尼尔