本文共 1007 字,大约阅读时间需要 3 分钟。
1.安装mysql
$ sudo apt-get install mysql-server2.字符集设置
$ sudo vim /etc/mysql/my.cnf追加如下内容
[client] default-character-set=utf8 #增加这一行,指定socket=/var/run/mysqld/mysqld.sock [mysqld] character_set_server=utf8 #增加这一行,指定字符集pid-file=/var/run/mysqld/mysqld.pid
3.验证
$ mysql -u root -p
mysql> SHOW VARIABLES LIKE ‘character_set_%’;+--------------------------+----------------------------+| 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/ |+--------------------------+----------------------------+
转载地址:http://pdfwl.baihongyu.com/