解析mysql 5.5字符集成績。本站提示廣大學習愛好者:(解析mysql 5.5字符集成績)文章只能為提供參考,不一定能成為您想要的結果。以下是解析mysql 5.5字符集成績正文
裝置了個5.5版本的mysql,字符集湧現了成績,之前的mysql辦事器都是經由過程在my.cnf設置裝備擺設文件中停止設置裝備擺設即可,可是今兒怎樣著都不可一向報錯:
其時體系中也沒有設置裝備擺設毛病日記,所以只能是先設置裝備擺設下毛病日記的地位,看看究竟是哪裡失足了:
user = mysql
pid-file = /var/run/mysqld/mysqld.pid
socket = /var/run/mysqld/mysqld.sock
port = 3306
basedir = /usr
datadir = /var/lib/mysql
tmpdir = /tmp
log-error=/var/log/mysql/error.log
lc-messages-dir = /usr/share/mysql
skip-external-locking
default-character-set=utf8
成果檢查了毛病日記才發明是字符集的毛病:
[ERROR] /usr/sbin/mysqld: unknown variable 'default-character-set=utf8'
竟然不熟悉,上彀上了找了下發明也有人碰到了,說是5.5中mysql不再應用default-character-set這類寫法了。
詳細請看:http://dev.mysql.com/doc/refman/5.5/en/server-options.html#option_mysqld_default-character-set
把default-character-set=utf8 改成: character-set-server=utf8便可以了。
root@chenDBA:/etc/mysql# vim my.cnf
root@chenDBA:/etc/mysql# service mysql start
mysql start/running, process 5904
root@chenDBA:/etc/mysql# mysql -uroot -p
Enter password:
mysql> show variables like 'character%';
+--------------------------+----------------------------+
| Variable_name | Value |
+--------------------------+----------------------------+
| character_set_client | utf8 |
| character_set_connection | utf8 |
| character_set_database | utf8 |
| character_set_filesystem | binary |
| character_set_results | utf8 |
| character_set_server | utf8 |
| character_set_system | utf8 |
| character_sets_dir | /usr/share/mysql/charsets/ |
+--------------------------+----------------------------+
8 rows in set (0.00 sec)
OK出工了。