解析mysql 5.5字元集問題

來源:互聯網
上載者:User

安裝了個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收工了。

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.