mysql tables

create database school;

use school;

create table teacher1 (id int(3) auto_increment not null primary key,name char(10) not null,address varchar(50));


insert into teacher1 values(8,'jack','大連二中');

insert into teacher1 values(7,'mak','大連二7中');

insert into teacher1 values(6,'xia','大連二6中');

insert into teacher1 values(5,'hou','大連二5中');

insert into teacher1 values(4,'yao','大連二4中');


insert into teacher1 values(3,'jhun','大連二3中');

insert into teacher1 values(2,'lihuan','大連二2中');

insert into teacher1 values(1,'zhang','大連二1中');

insert into teacher1 values(9,'bing','大連二9中');

insert into teacher1 values(10,'jiang','大連二中');

ERROR 1300 (HY000): Invalid utf8 character string: '\xA1\xB1'


create database `中國`;

show variables like 'char%';

--------------------------+----------------

| Variable_name            | Value

+--------------------------+----------------

| character_set_client     | gbk

| character_set_connection | gbk

| character_set_database   | latin1

| character_set_filesystem | binary

| character_set_results    | gbk

| character_set_server     | latin1

| character_set_system     | utf8

| character_sets_dir       | C:/Program File

+--------------------------+----------------

big5     | Big5 Traditional Chinese

gb2312   | GB2312 Simplified Chinese

gbk      | GBK Simplified Chinese

utf8     | UTF-8 Unicode

alter database mydb character set gbk(gbk);


set character_set_client=gbk;


set character_set_connection=gbk;


set character_set_results=gbk;



set names 'utf8'

create table test (id int(3) auto_increment not null primary key,name char(10) not null,address varchar(50));


insert into test values(8,'jack','大連二中');

insert into test values(7,'mak','大連二7中');

insert into test values(6,'xia','大連二6中');

insert into test values(5,'hou','大連二5中');

insert into test values(4,'yao','大連二4中');


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章