`

mac os x mysql数据库utf8配置

 
阅读更多

 

进入mysql console:

输入

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/local/mysql-5.1.30-osx10.5-x86/share/charsets/ | 

+--------------------------+-----------------------------------------------------+

8 rows in set (0.00 sec)


mysql>show variables like 'coll%';
+----------------------+-----------------+
| Variable_name        | Value           |
+----------------------+-----------------+
| collation_connection | utf8_general_ci | 
| collation_database   | utf8_general_ci | 
| collation_server     | utf8_general_ci | 
+----------------------+-----------------+
3 rows in set (0.00 sec)

 

如果有的项目不是utf8,我们需要进行设置

编辑/etc/my.cnf,如果没有该文件,从mysql的安装目录的support-files copy一个my-small.cnf到/etc下,更名为my.cnf

sudo cp /usr/local/mysql/support-files/my-medium.cnf /etc/my.cnf


sudo vi /etc/my.cnf

加入红色字体的部分,保存后,重启mysql,重新执行show命令,将会发现应该都是utf8

注意default-character-set = utf8,等号两边要有空格,很重要,不然配置文件不生效

 

 

 

 

# Example MySQL config file for small systems.

#

# This is for a system with little memory (<= 64M) where MySQL is only used

# from time to time and it's important that the mysqld daemon

# doesn't use much resources.

#

# You can copy this file to

# /etc/my.cnf to set global options,

# mysql-data-dir/my.cnf to set server-specific options (in this

# installation this directory is /usr/local/mysql/data) or

# ~/.my.cnf to set user-specific options.

#

# In this file, you can use all long options that a program supports.

# If you want to know which options a program supports, run the program

# with the "--help" option.

 

# The following options will be passed to all MySQL clients

[client]

#password = your_password

port = 3306

socket = /tmp/mysql.sock

default-character-set = utf8

 

# Here follows entries for some specific programs

 

# The MySQL server

[mysqld]

port = 3306

socket = /tmp/mysql.sock

skip-locking

key_buffer = 16K

max_allowed_packet = 1M

table_cache = 4

sort_buffer_size = 64K

read_buffer_size = 256K

read_rnd_buffer_size = 256K

net_buffer_length = 2K

thread_stack = 64K

init-connect = 'SET NAMES utf8'

character-set-server = utf8

collation-server = utf8_general_ci

default-character-set = utf8 

 

# Don't listen on a TCP/IP port at all. This can be a security enhancement,

# if all processes that need to connect to mysqld run on the same host.

# All interaction with mysqld must be made via Unix sockets or named pipes.

# Note that using this option without enabling named pipes on Windows

# (using the "enable-named-pipe" option) will render mysqld useless!

#skip-networking

server-id = 1

 

# Uncomment the following if you want to log updates

#log-bin=mysql-bin

 

# binary logging format - mixed recommended

#binlog_format=mixed

 

# Uncomment the following if you are using InnoDB tables

#innodb_data_home_dir = /usr/local/mysql/data/

#innodb_data_file_path = ibdata1:10M:autoextend

#innodb_log_group_home_dir = /usr/local/mysql/data/

#innodb_log_arch_dir = /usr/local/mysql/data/

# You can set .._buffer_pool_size up to 50 - 80 %

# of RAM but beware of setting memory usage too high

#innodb_buffer_pool_size = 16M

#innodb_additional_mem_pool_size = 2M

# Set .._log_file_size to 25 % of buffer pool size

#innodb_log_file_size = 5M

#innodb_log_buffer_size = 8M

#innodb_flush_log_at_trx_commit = 1

#innodb_lock_wait_timeout = 50

 

[mysqldump]

quick

max_allowed_packet = 16M

 

[mysql]

no-auto-rehash

# Remove the next comment character if you are not familiar with SQL

#safe-updates

 转自 http://jeffreyhsu.iteye.com/blog/348263

[isamchk]

key_buffer = 8M

sort_buffer_size = 8M

 

[myisamchk]

key_buffer = 8M

sort_buffer_size = 8M

 

[mysqlhotcopy]

interactive-timeout


分享到:
评论

相关推荐

    MySql 5.1 参考手册.chm

    10.6. 用于元数据的UTF8 10.7. 与其它DBMS的兼容性 10.8. 新字符集配置文件格式 10.9. 国家特有字符集 10.10. MySQL支持的字符集和校对 10.10.1. Unicode字符集 10.10.2. 西欧字符集 10.10.3. 中欧字符集 10.10.4. ...

    MySQL 5.1中文手冊

    10.6. 用于元数据的UTF8 10.7. 与其它DBMS的兼容性 10.8. 新字符集配置文件格式 10.9. 国家特有字符集 10.10. MySQL支持的字符集和校对 10.10.1. Unicode字符集 10.10.2. 西欧字符集 10.10.3. 中欧字符集 10.10.4. ...

    MySQL 5.1官方简体中文参考手册

    10.6. 用于元数据的UTF8 10.7. 与其它DBMS的兼容性 10.8. 新字符集配置文件格式 http://doc.mysql.cn/mysql5/refman-5.1-zh.html-chapter/(第 9/24 页)2006-11-02 19:12:13 MySQL 5.1 Reference Manual 10.9. ...

    MySQL 5.1参考手册

    10.6. 用于元数据的UTF8 10.7. 与其它DBMS的兼容性 10.8. 新字符集配置文件格式 10.9. 国家特有字符集 10.10. MySQL支持的字符集和校对 10.10.1. Unicode字符集 10.10.2. 西欧字符集 10.10.3. 中欧字符集 10.10.4. ...

    MySQL 5.1参考手册 (中文版)

    10.6. 用于元数据的UTF8 10.7. 与其它DBMS的兼容性 10.8. 新字符集配置文件格式 10.9. 国家特有字符集 10.10. MySQL支持的字符集和校对 10.10.1. Unicode字符集 10.10.2. 西欧字符集 10.10.3. 中欧字符集 10.10.4. ...

    MySQL 5.1参考手册中文版

    10.6. 用于元数据的UTF8 10.7. 与其它DBMS的兼容性 10.8. 新字符集配置文件格式 10.9. 国家特有字符集 10.10. MySQL支持的字符集和校对 10.10.1. Unicode字符集 10.10.2. 西欧字符集 10.10.3. 中欧字符集 ...

    MYSQL中文手册

    10.6. 用于元数据的UTF8 10.7. 与其它DBMS的兼容性 10.8. 新字符集配置文件格式 10.9. 国家特有字符集 10.10. MySQL支持的字符集和校对 10.10.1. Unicode字符集 10.10.2. 西欧字符集 10.10.3. 中欧字符集 ...

    mysql5.1中文手册

    用于元数据的UTF8 10.7. 与其它DBMS的兼容性 10.8. 新字符集配置文件格式 10.9. 国家特有字符集 10.10. MySQL支持的字符集和校对 10.10.1. Unicode字符集 10.10.2. 西欧字符集 10.10.3. 中欧...

    mysql官方中文参考手册

    10.6. 用于元数据的UTF8 10.7. 与其它DBMS的兼容性 10.8. 新字符集配置文件格式 10.9. 国家特有字符集 10.10. MySQL支持的字符集和校对 10.10.1. Unicode字符集 10.10.2. 西欧字符集 10.10.3. 中欧字符集 10.10.4. ...

    MySQL5.1参考手册官方简体中文版

    10.6. 用于元数据的UTF8 10.7. 与其它DBMS的兼容性 10.8. 新字符集配置文件格式 10.9. 国家特有字符集 10.10. MySQL支持的字符集和校对 10.10.1. Unicode字符集 10.10.2. 西欧字符集 10.10.3. 中欧字符集 10.10.4. ...

    docker-php72-nginx:用于搭建项目的Docker环境

    数据库 由于我们正在管理多个项目,因此需要使用一个容器,该容器可以从我们的任何应用程序容器访问。...使用 (Windows), (Mac OS X)之类的工具或容器本身内的CLI手动创建utf8mb4数据库。 docker exec

    ShopNC网上商城综合性多用户版 v2.7 build 20100901.rar

    适用于Windows Server Familiy、Linux、FreeBSD、Unix、Mac OS等多种操作系统; 多模板: 内置多套绚丽精美的模板,可任意设定,采用Smarty模板技术,使程序与模板完全隔离,可给众多爱好于美工设计 的朋友制造...

    OTL+代码+实例+帮助

    ODBC 3.x as well as ODBC 2.5 (for legacy applications) compliant data sources in MS Windows, Linux/Unix/Mac OS X (via unixodbc and iODBC driver managers): Sybase, MySQL, PostgreSQL, EnterpriseDB, ...

    ShopNC单用户商城系统 6.0

    适用于Windows Server Familiy、Linux、FreeBSD、Unix、Mac OS等多种操作系统; 多模板: 内置多套绚丽精美的模板,可任意设定,采用Smarty模板技术,使程序与模板完全隔离,可给众多爱好于美工设计 的朋友制造...

Global site tag (gtag.js) - Google Analytics