ToB企服应用市场:ToB评测及商务社交产业平台

标题: mysql 8.0设置collation_connection [打印本页]

作者: 光之使者    时间: 2022-9-28 22:30
标题: mysql 8.0设置collation_connection
设置全局
set global collation_connection = utf8mb4_general_ci 
 
设置会话级别
1.配置文件方式,给每个新的连接配置
[mysqld]
init-connect='SET NAMES utf8mb4 COLLATE utf8mb4_general_ci '
2.执行命令
set collation_connection = utf8mb4_general_ci 

SET NAMES utf8mb4 COLLATE utf8mb4_general_ci
 
附录:

 
 
 
 
 
 
 
 
SQL Statements for Connection Character Set Configuration

After a connection has been established, clients can change the character set and collation system variables for the current session. These variables can be changed individually using SET statements, but two more convenient statements affect the connection-related character set sytem variables as a group:
NoteSome character sets cannot be used as the client character set. Attempting to use them with SET NAMES or SET CHARACTER SET produces an error. See Impermissible Client Character Sets.
Example: Suppose that column1 is defined as CHAR(5) CHARACTER SET latin2. If you do not say SET NAMES or SET CHARACTER SET, then for SELECT column1 FROM t, the server sends back all the values for column1 using the character set that the client specified when it connected. On the other hand, if you say SET NAMES 'latin1' or SET CHARACTER SET 'latin1' before issuing the SELECT statement, the server converts the latin2 values to latin1 just before sending results back. Conversion may be lossy for characters that are not in both character sets.

免责声明:如果侵犯了您的权益,请联系站长,我们会及时删除侵权内容,谢谢合作!




欢迎光临 ToB企服应用市场:ToB评测及商务社交产业平台 (https://dis.qidao123.com/) Powered by Discuz! X3.4