版本:
在linux命令行下输入:
cat /etc/issue
Ubuntu 12.04 LTS \n \l
</pre><pre name="code" class="plain">mysql版本
mysql> status -------------- mysql Ver 14.14 Distrib 5.5.37, for debian-linux-gnu (x86_64) using readline 6.2
Threads: 1 Questions: 119 Slow queries: 0 Opens: 351 Flush tables: 1 Open tables: 86 Queries per second avg: 0.012 --------------我的mysql已经改为了utf8编码。
1、改编码
在linux命令行输入:sudo vim /etc/mysql/my.cnf
在[client] 节点下加入: default-character-set=utf8 在[mysqld]节点下加入: character-set-server=utf8 collation-server=utf8_general_ci
在linux命令行输入:/etc/init.d/mysql restart
打开mysql,输入status:
会出现
mysql Ver 14.14 Distrib 5.5.37, for debian-linux-gnu (x86_64) using readline 6.2 Connection id: 39 Current database: Current user: root@localhost SSL: Not in use Current pager: stdout Using outfile: '' Using delimiter: ; Server version: 5.5.37-0ubuntu0.12.04.1 (Ubuntu) Protocol version: 10 Connection: Localhost via UNIX socket Server characterset: utf8 Db characterset: utf8 Client characterset: utf8 Conn. characterset: utf8 UNIX socket: /var/run/mysqld/mysqld.sock Uptime: 2 hours 37 min 5 sec Threads: 1 Questions: 119 Slow queries: 0 Opens: 351 Flush tables: 1 Open tables: 86 Queries per second avg: 0.012
注意事项:
不可把default-character-set=utf8放在[mysqld]节点上,因为mysql5.0版本是不支持的,这样的话会报错或者无法启动mysql