分享

查看mysql字符集

 昵称5925841 2011-06-22
一、查看 MySQL 数据库服务器和数据库字符集。
mysql> show variables like '%char%';
+--------------------------+-------------------------------------+------
| Variable_name            | Value                               |......
+--------------------------+-------------------------------------+------
| 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       | D:\MySQL Server 5.0\share\charsets\ |......
+--------------------------+-------------------------------------+------
二、查看 MySQL 数据表(table) 的字符集。
mysql> show table status from sqlstudy_db like '%countries%';
三、查看 MySQL 数据列(column)的字符集。
mysql> show full columns from countries;
四、查看当前安装的 MySQL 所支持的字符集。
mysql> show charset;
mysql> show char set;
四.修改表和字段的字符集
//修改数据库
mysql> alter database name character set utf8;
//修改表
alter table 表名 convert to character set gbk;
//修改字段
alter table 表名 modify column '字段名' varchar(30) character set gbk not null;

    本站是提供个人知识管理的网络存储空间,所有内容均由用户发布,不代表本站观点。请注意甄别内容中的联系方式、诱导购买等信息,谨防诈骗。如发现有害或侵权内容,请点击一键举报。
    转藏 分享 献花(0

    0条评论

    发表

    请遵守用户 评论公约

    类似文章 更多