Mariadb对中文字符集的支持
来源:互联网 发布:java迭代器的使用 编辑:程序博客网 时间:2024/05/16 18:43
今天在写Django程序的时候,将Mariadb作为数据库,但是Mariadb(mysql的一个分支,完全兼容mysql,现由mysql创始人主导开发)默认不支持中文字符集,于是在网上搜集答案没有找到合适的解决办法,倒是Mariadb不能用了,只好卸载重装Mariadb,遇到一些麻烦,用的是ubuntu-14.04.
卸载有三步:1. 删除mysql-server: sudo apt-get autoremove --purge mysql-server-5.5;2. sudo apt-get remove mysql-common;3.清理残余数据,这一步很重要: sudo dpkg -l |grep ^rc|awk '{print $2}' |sudo xargs dpkg -P
然后重新安装mariadb即可sudo apt-get install mariadb-server.
再来解决中文字符集的问题
打开文件:vim /etc/mysql/my.cnf
在[client](也就是客户端)配置下添加一行:
default-character-set=utf8
在[mysqld](也就是mysql服务器配置)下添加两行:
init_connect='SET NAMES utf8'
character-set-server=utf8
然后重启mysql服务
sudo service mysql restart
这样在django应用里就可以顺利地使用中语言了,搞定,这是个老问题,以作记录。
0 0
- Mariadb对中文字符集的支持
- MariaDB中文乱码字符集处理
- Java字符集检测,更好的支持中文字符集
- JDK 1.5 对超大字符集的支持
- Informix数据库对UTF8字符集的支持
- Informix数据库对UTF8字符集的支持
- mysql字符集支持中文
- MariaDB与MySQL对比 --- 对分布式事务的支持
- CEGui对中文的支持
- Latex对中文的支持
- TeXmacs对中文的支持
- Trafodion 对中文的支持
- PBDOM对中文的支持
- git对中文的支持
- mariadb字符集
- Oracle 修改字符集 支持中文
- Boost库对unicode字符集的支持方式探究
- VS2013中对多字节字符集支持的方法
- http://www.doudoutxt.com/files/article/51465/281rs374.html
- ZOJ-3768
- http://www.doudoutxt.com/files/article/51465/632kl918.html
- http://www.doudoutxt.com/files/article/51465/110hi726.html
- 对方还是房间的大富大贵
- Mariadb对中文字符集的支持
- http://www.doudoutxt.com/files/article/51465/944xy447.html
- http://www.doudoutxt.com/files/article/51465/551bc169.html
- http://www.doudoutxt.com/files/article/51465/692cd797.html
- Simplifying printing in Windows 8-简化Windows8( win8) 打印驱动开发
- 递归算法的简单总结
- http://www.doudoutxt.com/files/article/51465/719jk227.html
- javascript显示年月日时间代码
- http://www.doudoutxt.com/files/article/51465/021rs119.html