---
title: "MySQL编码问题"
author: "jil5"
date: "2012-10-24T20:57:34Z"
tags: []
categories: ["数据库"]
slug: "mysql"
draft: false
lastmod: "2012-10-24T21:02:31Z"
id: 1704742
url: "https://jil5.iteye.com/blog/1704742"
---

在MySQL目录中打开my.ini文件

在其中找到

 

```
[client]

port=3306

[mysql]

default-character-set=GBK
```

 这里default-character-set指的是客户端敲的命令的编码 推荐这样就不需要每次敲setname命令

 

还有就是

 

```
[mysqld]

# The TCP/IP Port the MySQL Server will listen on
port=3306


#Path to installation directory. All paths are usually resolved relative to this.
basedir="C:/Program Files/MySQL/MySQL Server 5.0/"

#Path to the database root
datadir="C:/Program Files/MySQL/MySQL Server 5.0/Data/"

# The default character set that will be used when a new schema or table is
# created and no character set is defined
default-character-set=utf8

# The default storage engine that will be used when create new tables when
default-storage-engine=INNODB

# Set the SQL mode to strict
sql-mode="STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION"
```

 \[mysqld]是指mysql的服务 

下面default-character-set最好是utf8

 

Administrator

NLR8ZC-855091-6065785917886256

NLR8ZC-855379-60657856058589969

NLR8ZC-855897-6065785835010826

NLR8ZC-855098-60657856208825075