安裝了個(gè)5.5版本的mysql,字符集出現(xiàn)了問題,之前的mysql服務(wù)器都是通過在my.cnf配置文件中進(jìn)行配置便可,可是今兒怎么著都不行一直報(bào)錯(cuò):
當(dāng)時(shí)系統(tǒng)中也沒有配置錯(cuò)誤日志,所以只能是先配置下錯(cuò)誤日志的位置,看看到底是哪里出錯(cuò)了:
1.user = mysql
2.pid-file = /var/run/mysqld/mysqld.pid 3.socket = /var/run/mysqld/mysqld.sock 4.port = 3306 5.basedir = /usr 6.datadir = /var/lib/mysql 7.tmpdir = /tmp 8.log-error=/var/log/mysql/error.log 9.lc-messages-dir = /usr/share/mysql 10.skip-external-locking
11.default-character-set=utf8
結(jié)果查看了錯(cuò)誤日志才發(fā)現(xiàn)是字符集的錯(cuò)誤:
1.[ERROR] /usr/sbin/mysqld: unknown variable 'default-character-set=utf8'
居然不認(rèn)識(shí),上網(wǎng)上了找了下發(fā)現(xiàn)也有人遇到了,說是5.5中mysql不再使用default-character-set這種寫法了。
具體請(qǐng)看: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就可以了。
1.root@www.linuxidc.com:/etc/mysql# vim my.cnf
2.root@www.linuxidc.com:/etc/mysql# service mysql start
3.mysql start/running, process 5904
4.root@www.linuxidc.com:/etc/mysql# mysql -uroot -p
5.Enter password:
6.mysql> show variables like 'character%'; 7.+--------------------------+----------------------------+
8.| Variable_name | Value |
9.+--------------------------+----------------------------+
10.| character_set_client | utf8 |
11.| character_set_connection | utf8 |
12.| character_set_database | utf8 |
13.| character_set_filesystem | binary |
14.| character_set_results | utf8 |
15.| character_set_server | utf8 |
16.| character_set_system | utf8 |
17.| character_sets_dir | /usr/share/mysql/charsets/ |
18.+--------------------------+----------------------------+
19.8 rows in set (0.00 sec)
OK收工了。
本文出自:億恩科技【mszdt.com】
服務(wù)器租用/服務(wù)器托管中國五強(qiáng)!虛擬主機(jī)域名注冊頂級(jí)提供商!15年品質(zhì)保障!--億恩科技[ENKJ.COM]
|