进入mysql后 执行 :show variables like "% character %";
显示结果应该类似如下:
| character_set_client | utf8 |
| character_set_connection | utf8 |
| character_set_database | utf8 |
| character_set_results | utf8 |
| character_set_server | utf8 |
| character_set_system | utf8 |
| character_sets_dir | /usr/share/mysql/charsets/ |
如果仍有编码不是utf8的,请检查配置文件,也可使用mysql命令设置:
set character_set_client = utf8;
set character_set_server = utf8;
set character_set_connection = utf8;
set character_set_database = utf8;
set character_set_results = utf8;
set collation_connection = utf8_general_ci;
set collation_database = utf8_general_ci;
set collation_server = utf8_general_ci;
另外:
建立数据库时可以使用以下命令:
create database app_relation character set utf8;
use app_relation;
source app_relation.sql;
修改数据库编码的命令为:
alter database app_relation character set utf8;
本文出自 “Linux技术交流” 博客,请务必保留此出处http://9678130.blog.51cto.com/9668130/1774721
mysql数据库编码
标签:mysql、utf8、gb2312
本条技术文章来源于互联网,如果无意侵犯您的权益请点击此处反馈版权投诉
本文系统来源:http://9678130.blog.51cto.com/9668130/1774721