首页 技术 正文
技术 2022年11月21日
0 收藏 806 点赞 3,085 浏览 1267 个字

mysql> show variables like ‘character%’;

mysql> show variables like ‘collation%’;

mysql> status;

mysql> exit;

vim /etc/my.cnf

[mysqld]
default-storage-engine=INNODB
character-set-server=utf8
collation-server=utf8_general_ci

init_connect=’SET NAMES utf8′

[mysql]
default-character-set=utf8

[mysql.server]
default-character-set=utf8

[mysqld_safe]
default-character-set=utf8

[client]
default-character-set=utf8

:wq!

systemctl restart mysqld

2-MySQL数据库编码uft-8

mysql> show create database 数据库名;
mysql> show create table 表名;

设置默认编码为utf8:
set names utf8;

设置数据库db_name默认为utf8:
ALTER DATABASE `db_name` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
设置表tb_name默认编码为utf8:
ALTER TABLE `tb_name` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;

创建数据库的时候:

CREATE DATABASE `test`
CHARACTER SET ‘utf8’
COLLATE ‘utf8_general_ci’;

建表的时候:

CREATE TABLE `database_user`(
`ID` varchar(40) NOT NULL default ”,
`UserID` varchar(40) NOT NULL default ”,
)ENGINE=InnoDB DEFAULT CHARSET=utf8;

创建数据库

create table cantus(
id int(10) not null auto_increment primary key,
song char(20) not null,
album char(20) not null,
number smallint(5) not null,
writer char(12) not null,
composer char(12) not null,
singing char(12) not null,
lyric varchar(2000) not null);

create table orders(
id int(10) not null auto_increment primary key,
song char(20) not null,
album char(20) not null,
num smallint(5) not null,
number smallint(5) not null)ENGINE=InnoDB DEFAULT CHARSET=utf8;

相关推荐
python开发_常用的python模块及安装方法
adodb:我们领导推荐的数据库连接组件bsddb3:BerkeleyDB的连接组件Cheetah-1.0:我比较喜欢这个版本的cheeta…
日期:2022-11-24 点赞:878 阅读:9,000
Educational Codeforces Round 11 C. Hard Process 二分
C. Hard Process题目连接:http://www.codeforces.com/contest/660/problem/CDes…
日期:2022-11-24 点赞:807 阅读:5,512
下载Ubuntn 17.04 内核源代码
zengkefu@server1:/usr/src$ uname -aLinux server1 4.10.0-19-generic #21…
日期:2022-11-24 点赞:569 阅读:6,358
可用Active Desktop Calendar V7.86 注册码序列号
可用Active Desktop Calendar V7.86 注册码序列号Name: www.greendown.cn Code: &nb…
日期:2022-11-24 点赞:733 阅读:6,141
Android调用系统相机、自定义相机、处理大图片
Android调用系统相机和自定义相机实例本博文主要是介绍了android上使用相机进行拍照并显示的两种方式,并且由于涉及到要把拍到的照片显…
日期:2022-11-24 点赞:512 阅读:7,771
Struts的使用
一、Struts2的获取  Struts的官方网站为:http://struts.apache.org/  下载完Struts2的jar包,…
日期:2022-11-24 点赞:671 阅读:4,849