2-MySQL数据库编码uft-8
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

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;
2-MySQL数据库编码uft-8的更多相关文章
- 设置MYSQL数据库编码为UTF-8
设置MYSQL数据库编码为UTF-8 1. 编辑MySql的配置文件 MySql的配置文件Windows下一般在系统目录下或者在MySql的安装目录下名字叫my.ini,可以搜索,Linux下一 ...
- Linux下设置Mysql数据库编码
重装系统后,要装个mysql服务器,发现添加数据时,一直错误,查其原因,原来时编码问题.Google了一下,可都不太一样,可能时数据库版本问题吧. 查看数据库版本: select version(); ...
- linux 设置mysql 数据库编码utf8
转载地址http://www.linuxidc.com/Linux/2015-08/121676.htm在MySQL数据库中, 当插入数据无法支持中文时, 可将该数据库的编码集设置为utf8, 故在创 ...
- mysql数据库编码
MySQL数据库默认的编码是: character set :latin1 collation : latin1_swedish_ci 查看MySQL支持的编码: mysql> show cha ...
- linux下修改mysql数据库编码后无法启动解决办法
linux下老版本的Mysql修改数据库编码的方法是 修改my.cnf vi /etc/my.cnf 在[client]下添加 default-character-set=utf8 在[mysqld] ...
- mysql数据库编码、字段编码、表编码 专题
CREATE DATABASE `mybatis-subject` /*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_bin */ 其中的 ...
- 关于MySQL数据库编码修复相关问题
本篇主要是本人在实际开发过程中遇到的MySQL字符编码等bug修复相关问题. 在使用下列语句在执行数据库表通过flask-sqlacodegen 进行ORM映射成模型类的时候发生的bug: flask ...
- java.sql.SQLException: Illegal mix of collations (latin1_swedish_ci,IMPLICIT) and (utf8_general_ci,COERCIBLE) for operation '=' 异常处理,及MySQL数据库编码设置
java.sql.SQLException: Illegal mix of collations (latin1_swedish_ci,IMPLICIT) and (utf8_general_ci,C ...
- Mysql 数据库编码问题
数据库建表后,插入数据,如果数据位汉子,将提示错误:“incorrect string value....”. 解决方法:改变数据库编码 第一种方法:改变database 编码: alter data ...
- 修改mysql 数据库编码
查看编码 SHOW VARIABLES LIKE 'character_set_%'; 依次修改like出来的字段 例如 set character_set_results=utf8; 完了修改/e ...
随机推荐
- 【oracle】oracle表结构导出到Word
因为需要写数据库文档,所以需要把数据库里边的表结构在word中用表格列出来,之前一直用powerdesigner,感觉有些麻烦,后来在网上找到了一段sql语句,经测试完全符合我的需求,不敢独享,语句如 ...
- ACM: FZU 2110 Star - 数学几何 - 水题
FZU 2110 Star Time Limit:1000MS Memory Limit:32768KB 64bit IO Format:%I64d & %I64u Pr ...
- style
设计的默认单位为px; 为了简化设计,都是以750px为基本单位设计的,如果屏幕大小不同,它会根据屏幕大小自动缩放. 它的样式选择和CSS非常类似,但是和CSS选择器不同的是,它只支持单级选择,不支持 ...
- .net core 关键概念
startup startup asp.net core 的入口,在构造函数中完成环境参数的配置. 其中Configure 方法是用来控制如何respond一个http请求的, 例如配置l ...
- Testing with a mocking framework (EF6 onwards)
When writing tests for your application it is often desirable to avoid hitting the database. Entity ...
- ios 单例设计模式
单例模式的意思就是只有一个实例.单例模式确保某一个类只有一个实例,而且自行实例化并向整个系统提供这个实例.这个类称为单例类.单例可用性非常高,用于登录用户管理等可供全局调用. + (AccountMa ...
- 快排查找第K小的数
#include "iostream.h" using namespace std; int findMedian(int *A,int left,int right){ int ...
- XSS攻击
什么是XSS? http://www.cnblogs.com/bangerlee/archive/2013/04/06/3002142.html XSS攻击及防御? http://blog.csdn. ...
- MySQL优化性能my.cnf详解
提供一个MySQL 5.6版本适合在1GB内存VPS上的my.cnf配置文件(点击这里下载文件): [client] port=3306 socket=/tmp/mysql.sock [mysqld] ...
- 205 Reset Content
https://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html The server has fulfilled the request and the ...