Home > Database > Mysql Tutorial > mysql修改编码Linux/Mac/Unix/通用_MySQL

mysql修改编码Linux/Mac/Unix/通用_MySQL

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-01 13:34:19
Original
797 people have browsed it

bitsCN.com

mysql修改编码Linux/Mac/Unix/通用

 

修改mysql的编码需要用到myslq的配置文件,该文件在/etc/my.cnf,mac用户默认是没有这个文件的,可以到mysql的安装目录/support-files中找任意一个my-***.cnf拷贝到/ect中! 

 

最近修改mysql的默认编码,根据网上搜到的方法,说在[mysqld]下加default-character-set = utf8,会导致Error 2003错误!造成mysql根本无法启动。 

 

后来查了很多资料,发现应该这样修改: 

 

在[client]下面加default-character-set = utf8 

 

然后在[mysqld]下面加入以下三行: 

 

default-storage-engine = INNODB 

character-set-server = utf8 

collation-server = utf8_general_ci 

 

然后重新启动服务就可以了,linux用户使用命令services mysql restart 

 

mac用户使用 /Library/StartupItems/MySQLCOM/MySQLCOM restart

 

bitsCN.com
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template