加入收藏 | 设为首页 | 会员中心 | 我要投稿 安卓应用网 (https://www.0791zz.com/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 数据库 > MySql > 正文

MySQL 查看编码 排序规则

发布时间:2020-05-22 18:57:28 所属栏目:MySql 来源:互联网
导读:查看数据库的排序规则mysql show variables like collation%;+----------------------+-------------------+| Variable_name | Value |+----------------------+-------------------+| collation_connection | utf8_general_ci || collation_database | utf8_

查看的排序规则

mysql show variables Variable_name Value collation_connection utf8_general_ci collation_database utf8_general_ci collation_server latin1_swedish_ci rows ( sec)

查看数据库的编码格式

mysql show variables Variable_name Value character_set_client utf8 character_set_connection utf8 character_set_database utf8 character_set_filesystem character_set_results utf8 character_set_server latin1 character_set_system utf8 character_sets_dir usrsharemysqlcharsets rows ( sec)

查看字段的排序规则

mysql show tablename;

查看表字段信息

mysql tablename;

查看当前数据库编码

mysql mysql<span style="color: #808080;">> show variables <span style="color: #808080;">like <span style="color: #ff0000;">'<span style="color: #ff0000;">character_set_database<span style="color: #ff0000;">'<span style="color: #000000;">;
<span style="color: #808080;">+<span style="color: #008080;">--<span style="color: #008080;">----------------------+-------+
<span style="color: #808080;">| Variable_name <span style="color: #808080;">| Value <span style="color: #808080;">|
<span style="color: #808080;">+<span style="color: #008080;">--<span style="color: #008080;">----------------------+-------+
<span style="color: #808080;">| character_set_database <span style="color: #808080;">| utf8 <span style="color: #808080;">|
<span style="color: #808080;">+<span style="color: #008080;">--<span style="color: #008080;">----------------------+-------+
<span style="color: #800000; font-weight: bold;">1 row <span style="color: #808080;">in <span style="color: #0000ff;">set (<span style="color: #800000; font-weight: bold;">0.03 sec)

修改当前数据库的编码

mysql mysql<span style="color: #808080;">> <span style="color: #0000ff;">alter <span style="color: #0000ff;">database databasename <span style="color: #0000ff;">character <span style="color: #0000ff;">set<span style="color: #000000;"> latin1; #将之前的utf8编码修改为latin1编码
Query OK,<span style="color: #800000; font-weight: bold;">1 row affected (<span style="color: #800000; font-weight: bold;">0.00<span style="color: #000000;"> sec)
<span style="color: #808080;">+<span style="color: #008080;">--<span style="color: #008080;">----------------------+--------+
<span style="color: #808080;">| Variable_name <span style="color: #808080;">| Value <span style="color: #808080;">|
<span style="color: #808080;">+<span style="color: #008080;">--<span style="color: #008080;">----------------------+--------+
<span style="color: #808080;">| character_set_database <span style="color: #808080;">| latin1 <span style="color: #808080;">|
<span style="color: #808080;">+<span style="color: #008080;">--<span style="color: #008080;">----------------------+--------+
<span style="color: #800000; font-weight: bold;">1 row <span style="color: #808080;">in <span style="color: #0000ff;">set (<span style="color: #800000; font-weight: bold;">0.00 sec)

查看字段编码

SHOW COLUMNS tablename;

修改字段的字符集

tablename CHANGE c_name c_name character_name users CHANGE title title () utf8 COLLATE utf8_general_ci;

(编辑:安卓应用网)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读