可能会有一些错误,随时校正,欢迎大家指点建议。

1.创建库时指定编码:create database testdb default charset GBK
2.修改库的编码: ALTER DATABASE `testtable` DEFAULT CHARACTER SET utf8 COLLATE utf8_bin

3.修改表的编码:ALTER TABLE `testtable` DEFAULT CHARACTER SET utf8 COLLATE utf8_bin 4

4.修改字段的编码:
ALTER TABLE `tablename` CHANGE `dd` `dd` VARCHAR( 45 ) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL

5.查看数据库支持的所有字符集
show character set;或show char set;

6.查看当前状态 里面包括当然的字符集设置
status或者\s

7.查看系统字符集设置,包括所有的字符集设置
show variables like 'char%';

8.查看数据表中字符集设置
show full columns from tablename; 或者 show create tabletablename\G;

9.查看数据库编码
show create database dnname;

相关文章:

  • 2021-04-29
  • 2021-11-28
  • 2021-11-28
  • 2021-04-12
  • 2021-12-15
  • 2021-11-28
  • 2021-10-09
  • 2021-11-17
猜你喜欢
  • 2021-11-28
  • 2021-11-20
  • 2021-11-28
  • 2021-11-20
  • 2021-12-08
  • 2021-12-08
相关资源
相似解决方案