Home > Database > Mysql Tutorial > 转载-----更改MySQL的默认字符集方法集锦_MySQL

转载-----更改MySQL的默认字符集方法集锦_MySQL

WBOY
Release: 2016-06-01 13:37:37
Original
791 people have browsed it

bitsCN.com

 方法1、 用 SET 语法来指定,不加 “GLOBAL” 的话就只对本次会话有效

SET [GLOBAL] character_set_client = utf8;
SET [GLOBAL] character_set_connection = utf8;
SET [GLOBAL] character_set_database = utf8;
SET [GLOBAL] character_set_results = utf8;
SET [GLOBAL] character_set_server = utf8;

方法2、 也用SET语法,只对本次会话有效

SET NAMES ‘utf8′;

方法3、 直接修改 my.ini,增加一行内容,然后重启 MySQL,使之全局生效

default-character-set = utf8

bitsCN.com
Related labels:
use
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