时间:2021-07-01 10:21:17 帮助过:42人阅读
进入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