Home  >  Article  >  Database  >  设置MySql数据库的字符编码为UTF8

设置MySql数据库的字符编码为UTF8

WBOY
WBOYOriginal
2016-06-07 15:27:451144browse

设置MySql数据库的字符编码为UTF8 1.在mysql压缩目录下,有一堆的参数配置文件,比如:my-small.ini,复制一下这个文件,自己改下名字,比如叫:my.ini 2.打开my.ini文件,增加如下参数: [client]:增加default-character-set=utf8参数,例如: [client] #p

  设置MySql数据库的字符编码为UTF8

  1.在mysql压缩目录下,有一堆的参数配置文件,比如:my-small.ini,复制一下这个文件,自己改下名字,比如叫:my.ini

  2.打开my.ini文件,增加如下参数:

  [client]:增加default-character-set=utf8参数,例如:

  [client]

  #password = [your_password]

  port = 3306

  socket = /tmp/mysql.sock

  default-character-set=utf8

  [mysqld]:增加如下3个参数,例如:

  [mysqld]

  default-storage-engine=INNODB

  character-set-server=utf8

  collation-server=utf8_general_ci

  # generic configuration options

  port = 3306

  socket = /tmp/mysql.sock

  3.设置完成后,重启下mysql服务

  4.连接上你的数据库之后,输入命令:SHOW VARIABLES LIKE '%char%';即可查看到现在你的数据库所使用的字符集了

Statement:
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