先贴出代码(/etc/my.cnf)如下:

#The following options will be passed to all MySQL clients
[client]
#password       = your_password
port            = 3306
socket          = /var/lib/mysql/mysql.sock
default_character_set=utf8 --编码问题
default-character-set=utf8 --编码问题

还有[mysqld]下 的:

[mysqld]
port            = 3306
socket          = /var/lib/mysql/mysql.sock
skip-locking
key_buffer_size = 16M
max_allowed_packet = 1M
table_open_cache = 64
sort_buffer_size = 512K
net_buffer_length = 8K
read_buffer_size = 256K
read_rnd_buffer_size = 512K
myisam_sort_buffer_size = 8M
default_character_set=utf8 --编码问题
default-character-set=utf8 --编码问题
init_connect='SET NAMES utf8--编码问题
lower_case_table_names=1 --解决linux下mysql区分大小写问题

ok!

===================================================================

=                                                                                                                                  =

===================================================================

默认my.cnf文件不是这样的,这个是拷贝过来的,步骤:

# find / -iname *.cnf -print

# find / -iname *.cnf -print
/root/Desktop/mysql-5.0.56/mysql-test/std_data/ndb_config_mycnf1.cnf /root/Desktop/mysql-5.0.56/mysql-test/std_data/bug15328.cnf /root/Desktop/mysql-5.0.56/mysql-test/std_data/ndb_config_mycnf2.cnf /etc/my.cnf /etc/pki/tls/openssl.cnf /usr/share/mysql/my-medium.cnf /usr/share/mysql/my-large.cnf /usr/share/mysql/my-small.cnf /usr/share/mysql/my-huge.cnf /usr/share/mysql/my-innodb-heavy-4G.cnf /usr/share/doc/MySQL-server-community-5.0.92/my-medium.cnf /usr/share/doc/MySQL-server-community-5.0.92/my-large.cnf /usr/share/doc/MySQL-server-community-5.0.92/my-small.cnf /usr/share/doc/MySQL-server-community-5.0.92/my-huge.cnf /usr/share/doc/MySQL-server-community-5.0.92/my-innodb-heavy-4G.cnf

拷贝一个出来

cp /usr/share/doc/MySQL-server-community-5.0.92/my-medium.cnf  /etc/my.cnf

是否覆盖:Y。

=====================================================================

打开:

vi /etc/my.cnf

按上面修改后,按两次大写Z保存退出。

=======================================================================

重启mysqld

# service mysqld restart

=====================================================================

posted on 2014-07-18 09:34  笨笨多  阅读(274)  评论(0编辑  收藏  举报