创建存储过程:设置字符集和排序规则 [英] Creating a stored procedure: setting the character set and collation
问题描述
创建MySQL存储过程时如何设置字符集和排序规则? MySQL文档不提供任何示例,也不提供一般语法稍微不清楚。
When creating a MySQL stored procedure how does one set the character set and collation? The MySQL documentation does not provide any examples and to the general syntax is slightly unclear.
mysql> show procedure status\G
*************************** 1. row ***************************
Db: MslLandingSequence
Name: DeploySkycrane
Type: PROCEDURE
Definer: curiosity@localhost
Modified: 2012-08-04 00:05:16
Created: 2011-11-12 00:02:45
Security_type: DEFINER
Comment:
character_set_client: latin1
collation_connection: latin1_swedish_ci
Database Collation: latin1_swedish_ci
项应该是Unicode。感谢。
The last three items should be Unicode. Thanks.
推荐答案
omg omg omg
omg omg omg
character_set_client是创建例程时character_set_client
系统变量的会话值。 collation_connection是
创建
例程时collation_connection系统变量的会话值。数据库排序规则是与例程关联的
数据库的排序规则。这些列是在MySQL 5.1.21中添加的
。
character_set_client is the session value of the character_set_client system variable when the routine was created. collation_connection is the session value of the collation_connection system variable when the routine was created. Database Collation is the collation of the database with which the routine is associated. These columns were added in MySQL 5.1.21.
http://dev.mysql.com/doc/refman/5.1/en/show-procedure-status.html
简而言之,打开一个mysql命令行,输入
In short, open a mysql command line, type in
SET NAMES UTF8;
然后删除并重新导入存储过程。这固定了我的问题。我甚至不想考虑5.1.21之前的用户。他们在黑暗中摸索着!
then drop and reimport the stored procedures. This fixed my problem. I don't even want to think about pre 5.1.21 users. They are fumbling in the dark!
这篇关于创建存储过程:设置字符集和排序规则的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!