집 >데이터 베이스 >MySQL 튜토리얼 >MySql表、字段、库的字符集修改及查看方法_MySQL
修改数据库字符集:
代码如下:
ALTER DATABASE db_name DEFAULT CHARACTER SET character_name [COLLATE ...];
代码如下:
ALTER TABLE tbl_name CONVERT TO CHARACTER SET character_name [COLLATE ...]
只是修改表的默认字符集:
代码如下:
ALTER TABLE tbl_name DEFAULT CHARACTER SET character_name [COLLATE...];
修改字段的字符集:
代码如下:
ALTER TABLE tbl_name CHANGE c_name c_name CHARACTER SET character_name [COLLATE ...];
查看数据库编码:
代码如下:
SHOW CREATE DATABASE db_name;
代码如下:
SHOW CREATE TABLE tbl_name;
代码如下:
SHOW FULL COLUMNS FROM tbl_name;