---
layout: post
title: MySQL中文乱码
---

### 修改my.cnf

* 1.修改[client]字段

        port = 3306  
        socket = /var/lib/mysql.sock  
        default-character-set = utf8  

* 2.修改[mysqld]字段

```sh
   port=3306
   socket = /var/lib/mysql/mysql.sock
   character-set-server=utf8
```


* 3.修改[mysql]字段

```sh
    no-auto-rehash  
    default-character-set=utf8
```
