如果使用的是linux自带的mysql,那么它的配置文件(my.cnf)是:
[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
user=mysql
# Default to using old password format for compatibility with mysql 3.x
# clients (those using the mysqlclient10 compatibility package).
old_passwords=1
# default-character-set=gb2312
[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
# [mysql]
# default-character-set=gb2312
蓝色字体是原配置没有的,把[mysql]及两个default-character-set放开,就是设置了mysql启动的默认编码,不设置的话,是latin1。
如果是自己安装的mysql,到/usr/local/mysql/share/mysql中,将my-medium.cnf拷贝到/etc中,改名为my.cnf。如果是使用linux自带mysql的配置的话,则改变设置如下:
[mysqld]
datadir=/usr/local/mysql/var
socket=/tmp/mysql.sock
user=mysql
# Default to using old password format for compatibility with mysql 3.x
# clients (those using the mysqlclient10 compatibility package).
old_passwords=1
default-character-set=gb2312
[mysqld_safe]
log-error=/usr/local/mysql/..err
pid-file=/usr/local/mysql/var/..pid
[mysql]
default-character-set=gb2312
阅读(3081) | 评论(0) | 转发(0) |