方法 1.创建数据库时指定字符集. create database Studio character set utf8; 方法 2.创建表的时候针对列指定字符集. create table T( x varchar(32) character set utf8); 方法 3.创建表时针对表指定字符集 create table T2(x varchar(32)) character set utf8;…
my.cnf [mysqld] character-set-server=utf8 [mysqld_safe] default-character-set=utf8 -- 创建数据库时,设置数据库的编码方式 -- CHARACTER SET:指定数据库采用的字符集,utf8不能写成utf-8 -- COLLATE:指定数据库字符集的排序规则,utf8的默认排序规则为utf8_general_ci(通过show character set查看) drop database if EXISTS db…
实体类 public class TestDbContext : DbContext { public DbSet<Test> Tests { get; set; } public TestDbContext() : base() { } } public class Test { public long ID { get; set; } public string Name { get; set; } public string Email { get; set; } public stri…
原文:http://www.andyqian.com/2016/04/06/database/mysqleindex/ 在mysql中有多种索引,有普通索引,全文索引,唯一索引,多列索引,小伙伴们可以通过不同的应用场景来进行索引的新建,在此列出三种新建索引的方法 mysql 中添加索引的三种方法 1.1 新建表中添加索引 ① 普通索引 1234567 create table t_dept( no int not null primary key, name varchar(20) null,…