Home > Database > Mysql Tutorial > body text

Ubuntu上的MySQL字符集设置技巧

WBOY
Release: 2016-06-07 16:51:37
Original
1035 people have browsed it

Ubuntu上mysql默认安装使用的字符集是latin1。 1 查看字符集支持 show character set; 2 查看字符集相关变量 show variables like quot;ch

Ubuntu上mysql默认安装使用的字符集是latin1。

1 查看字符集支持

show character set;

2 查看字符集相关变量

show variables like "character_set%";

3 设置默认字符集

为解决乱码问题,最简单的办法就是修改默认字符集。修改默认字符集为utf8:

找到/etc/mysql/my.cnf,在[mysqld]下加上:default-character-set=utf8

或者如果装了桌面系统,可以用mysqladmin修改启动参数,选项Advanced里的Def.CharSet修改成utf8,,保存重启,不过一般用户无法修改这个选项。可以用root用户打开my.cnf修改。

4 linux下启动、停止与重启

/etc/init.d/mysql start/stop/restart 

linux

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template