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 ...
随机推荐
- tornado 学习笔记7 RequestHandler功能分析
在第5部分讲到,构建一个tornado网站,必须包含一个或者多个handler,这些handler是RequestHandler的子类.每个请求都会被映射到handler中进行处理,处理 ...
- Updating My Notepad_1.1
The old version Notepad 1.0 you can get it from below link : My Notepad I am very happy to announce ...
- CF #375 (Div. 2) D. bfs
1.CF #375 (Div. 2) D. Lakes in Berland 2.总结:麻烦的bfs,但其实很水.. 3.题意:n*m的陆地与水泽,水泽在边界表示连通海洋.最后要剩k个湖,总要填掉多 ...
- osgAnimation例子的注释的注释
osgAnimation例子的注释的注释 转自:http://www.cnblogs.com/sunliming/archive/2011/12/12/2284995.html #include &l ...
- 【JAE】JAE京东云擎部署首个Java应用
前几天一直在寻找好用并且免费的PaaS最终就发现了国内的京东云擎JAE和国外的Heroku.我首先选择的是Heroku,因为他有一个非常强大的eclipse插件 为开发带来了很大的方便.用它提交后的代 ...
- wordexpress
登陆数据库:mysql -uroot -p 创建数据库:CREATE DATABASE wordpress; 创建数据库用户:CREATE USER wordpress@localhost IDENT ...
- WM_COPYDATA进程间通信方案
连续在两个公司使用WM_COPYDATA实现进程间通信了,整理一下 具体步骤: 一. 进程A通过ShellExecute启动进程B, 将用于通信的窗口句柄hWndA(已强转为int值)通过命令行参 ...
- SQL语法整理
SQL是Structured Query Language的缩写,中文全名为结构化查询语言,是一种用于数据存储,查询,更新和管理的关系数据库系统. SQL语法 创建表 create table tab ...
- JavaScript:Location
读取.设置url 在url中输入:http://www.cnpiont.com:8090/index.html?user=like&pwd=123#title Console输入: docum ...
- JBoss QuickStart之Helloworld
下载Jboss, quickstart, 按照quickstart说明, mvn clean install. 由于ssl handshake问题(应该是网络连接不稳定), 写了一个脚本不停地尝试bu ...