当前位置:Gxlcms > mysql > MySQL字符集中所设定参数

MySQL字符集中所设定参数

时间:2021-07-01 10:21:17 帮助过:33人阅读

以下的文章主要描述的是MySQL字符集中所设定的所有相关参数UTF8,我们在安装完成之后已经MySQL字符集(和PHP搭配之最佳组合)进行设置 ,把它设置为utf8。具体的操作内容如下,望你会有所领悟。 但是 MySQL(和PHP搭配之最佳组合) SHOWVARIABLESLIKE'collation_

以下的文章主要描述的是MySQL字符集中所设定的所有相关参数UTF8,我们在安装完成之后已经MySQL字符集(和PHP搭配之最佳组合)进行设置 ,把它设置为utf8。具体的操作内容如下,望你会有所领悟。

但是

  1. MySQL(和PHP搭配之最佳组合)> SHOW VARIABLES LIKE 'collation_%';
  2. +----------------------+-------------------+
  3. | Variable_name | Value |
  4. +----------------------+-------------------+
  5. | collation_connection | latin1_swedish_ci |
  6. | collation_database | utf8_general_ci |
  7. | collation_server | utf8_general_ci |
  8. +----------------------+-------------------+
  9. 3 rows in set (0.00 sec)
  10. MySQL(和PHP搭配之最佳组合)> SHOW VARIABLES LIKE 'character_set_%';
  11. +--------------------------+------------------------------------------------+
  12. | Variable_name | Value |
  13. +--------------------------+------------------------------------------------+
  14. | character_set_client | latin1 |
  15. | character_set_connection | latin1 |
  16. | character_set_database | utf8 |
  17. | character_set_results | latin1 |
  18. | character_set_server | utf8 |
  19. | character_set_system | utf8 |
  20. | character_sets_dir | D:\data\MySQL(和PHP搭配之最佳组合)\MySQL(和PHP搭配之最佳组合) Server 4.1\share\charsets/ |
  21. +--------------------------+------------------------------------------------+
  22. 7 rows in set (0.00 sec)

发觉画线标注的属性还是非 utf8的。

然后修改 my.ini 文件,设置

以下是代码片段:

  1. [client]
  2. default-character-set=utf8
  3. [MySQL(和PHP搭配之最佳组合)]
  4. default-character-set=utf8
  5. [MySQL(和PHP搭配之最佳组合)d]
  6. default-character-set=utf8

copy my.ini 文件到 windows目录

启动MySQL字符集(和PHP搭配之最佳组合) 以下是代码片段:

  1. MySQL(和PHP搭配之最佳组合)> SHOW VARIABLES LIKE ’character_set_%’;
  2. +--------------------------+------------------------------------------------+
  3. | Variable_name | Value |
  4. +--------------------------+------------------------------------------------+
  5. | character_set_client | utf8 |
  6. | character_set_connection | utf8 |
  7. | character_set_database | utf8 |
  8. | character_set_results | utf8 |
  9. | character_set_server | utf8 |
  10. | character_set_system | utf8 |
  11. | character_sets_dir | D:\data\MySQL(和PHP搭配之最佳组合)\MySQL(和PHP搭配之最佳组合) Server 4.1\share\charsets/ |
  12. +--------------------------+------------------------------------------------+
  13. 7 rows in set (0.00 sec)
  14. MySQL(和PHP搭配之最佳组合)> SHOW VARIABLES LIKE ’character_set_%’;
  15. +--------------------------+------------------------------------------------+
  16. | Variable_name | Value |
  17. +--------------------------+------------------------------------------------+
  18. | character_set_client | utf8 |
  19. | character_set_connection | utf8 |
  20. | character_set_database | utf8 |
  21. | character_set_results | utf8 |
  22. | character_set_server | utf8 |
  23. | character_set_system | utf8 |
  24. | character_sets_dir | D:\data\MySQL(和PHP搭配之最佳组合)\MySQL(和PHP搭配之最佳组合) Server 4.1\share\charsets/ |
  25. +--------------------------+------------------------------------------------+
  26. 7 rows in set (0.00 sec)

一切正常了。创建数据库:以下是代码片段:

  1. create table t_sysuser (
  2. USERID integer not null auto_increment,
  3. USERNAME varchar(30),
  4. PASSWORDS varchar(30),
  5. DEPTNO varchar(30),
  6. HEADSHIP varchar(30),
  7. SEX varchar(4),
  8. TEL varchar(18),
  9. EMAIL varchar(30),
  10. URL varchar(30),
  11. PCALL varchar(20),
  12. USERPHOTO varchar(255),
  13. FACEREFUTIME integer,
  14. FACELANGUAGE varchar(1),
  15. LASTMODIF varchar(30),
  16. LASTMDATE datetime,
  17. CREADTOR varchar(30),
  18. CREATDATE datetime,
  19. Prima(最完善的虚拟主机管理系统)ry key (USERID)
  20. ) ENGINE=InnoDB DEFAULT CHARSET=utf8;

全部搞定。

人气教程排行