Home >Database >Mysql Tutorial >精简mysql中文乱码解决方法_MySQL

精简mysql中文乱码解决方法_MySQL

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-06-01 13:54:38883browse

一: windows系统下mysql中文显示乱码最简解决方法

mysql> set names gb2312; 然后敲回车ok!

前提是安装的时候选utf8编码格式安装。

二:linux系统下mysql中文乱码最简解决方法

在/etc/mysql/目录下,修改文件my.cnf

主要配置文件修改有两处:

到客户端配置[client] 在下面添加

### 默认字符集为utf8

default-character-set=utf8

在找到[mysqld] 添加

### 默认字符集为utf8

default-character-set=utf8

### (设定连接mysql数据库时使用utf8编码,以让mysql数据库为utf8运行)

init_connect='SET NAMES utf8' 

修改后重新启动,以后都是OK。

Statement:
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