MYSQL DB实例查询修改字符编码

查看DB的字符编码

#mysql -uroot -proot

mysql>use information_schema

DataBase changed

mysql>select * from SCHEMATA where SCHEMA_NAME='cici';

+--------------+-------------+----------------------------+------------------------+----------+

|CATALOG_NAME|SCHEMA_NAME|DEFAULT_CHARACTER_SET_NAME|DEFAULT_COLLATION_NAME|SQL_PATH|

+--------------+-------------+----------------------------+------------------------+----------+

|NULL|cici|latin1|latin1_swedish_ci|NULL|

+--------------+-------------+----------------------------+------------------------+----------+

修改DB的字符编码方式

mysql>alter database cici character set utf8;验证

mysql>use information_schema;

mysql> select * from SCHEMATA where SCHEMA_NAME='cici';

+--------------+-------------+----------------------------+------------------------+----------+

|CATALOG_NAME|SCHEMA_NAME|DEFAULT_CHARACTER_SET_NAME|DEFAULT_COLLATION_NAME|SQL_PATH|

+--------------+-------------+----------------------------+------------------------+----------+

|NULL|cici|utf8|utf8_general_ci|NULL|

+--------------+-------------+----------------------------+------------------------+----------+

====================参考资料===============================

http://blog.chinaunix.net/uid-10697776-id-3226131.html

相关推荐