Home  >  Article  >  Database  >  mysql创建数据库指定编码格式_MySQL

mysql创建数据库指定编码格式_MySQL

WBOY
WBOYOriginal
2016-06-01 13:13:191188browse

在mysql中使用sql语句创建数据库时,老是忘记指定编码格式。这就导致了使用utf-8格式的工程访问数据库的过程中产生中文乱码的问题。后来发现大部分问题出自创建数据库的时候没有指定编码格式。创建数据库指定编码格式的一种方法是在创建数据库sql语句中指定编码格式,如下所示,指定数据库编码格式为utf-8

CREATE DATABASE `test2` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;

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