Home > Database > Mysql Tutorial > Ubuntu下彻底解决mysql中文乱码

Ubuntu下彻底解决mysql中文乱码

WBOY
Release: 2016-06-07 15:46:32
Original
1305 people have browsed it

Mysql5.5默认的是客户端和服务器都用了latin1,所以会乱码 查看MySQL字符集:#show variables like character%; 1. #sudo vim /etc/mysql/my.cnf 在相应位置添加如下设置 [client] default_character_set=utf8 [mysqld] character-set-server=utf8 2.重启my

Mysql5.5默认的是客户端和服务器都用了latin1,所以会乱码

查看MySQL字符集:#show variables like "character%";

1. #sudo vim /etc/mysql/my.cnf

在相应位置添加如下设置

[client]
default_character_set=utf8

[mysqld]
character-set-server=utf8

2. 重启mysql

#sudo service mysql stop

#sudo service mysql start


解决!




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