一、MySQL的字符集层次

字符集(Character set)和排序方式(Collation)。

MySQL对于字符集的支持细化到四个层次: 服务器(server),数据库(database),数据表(table)和连接(connection)。


二、查看MySQL字符集

2.1  查看字符集的设置

1
mysql> show variables like 'character_set_%';

MySQL设置字符集

2.2  查看字符集排序设置

1
mysql> show variables like 'collation_%';

MySQL设置字符集

三、修改MySQL字符集

3.1  client

1
default-character-set=utf8

MySQL设置字符集

3.2  mysqld

1
character_set_server=utf8

MySQL设置字符集


注意:再来mysqld中不能使用'default-character-set=utf8',否则报mysqld: unknown variable 'default-character-set=utf8'。


相关文章:

  • 2021-12-22
猜你喜欢
  • 2021-05-28
  • 2021-12-29
  • 2021-11-03
  • 2022-02-07
  • 2022-01-14
相关资源
相似解决方案