网站看了很多人转来转去的mysql的字符集修改为utf8的文章,也不知道同胞们有没有自己亲手试验过,反正我根据那些文章配置后就是启动不了。
这里我把我的贴出来。
# vi /etc/my.cf
[client]
default-character-set=utf8
[mysql]
default-character-set=utf8 ----------尤其注意,这句话写在mysqld中会报ERROR! The server quit without updating PID file (/var/lib/mysql/localhost.localdomain.pid)之类的错误。
[mysqld]
character-set-server=utf8
init_connect='SET NAMES utf8'
# mysql -u root -p
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)