Illegal mix of collations (latin1_swedish_ci,IMPLICIT) and (utf8_general_ci,COER) 解决办法

解决Mysql:Illegal mix of collations (gbk_chinese_ci,IMPLICIT) and (utf8_general_ci,COERCIBLE) for operation '=' <br /><br />发现是字符集的问题<br />首先、查看mysql的my.cnf,确认为utf8<br /><br />mysql> show variables like "%char%";<br />+--------------------------+-------------------------------------+<br />| Variable_name            | Value                               |<br />+----- 阅读详情

在向mysql 插入中文的过程中,系统报错:

Illegal mix of collations (latin1_swedish_ci,IMPLICIT) and (utf8_general_ci,COER)

这是由于mysql 默认的编码格式与存入的数据格式不一样导致的,解决办法:

打开mysql安装目录,里面有个my.ini文件,打开这个文件,里面有两处字符集的设置,默认是拉丁(latin1),建议你所想改的,如:utf8或gbk

打开my.ini 找到这两处地方修改:(如果想显示中文建议修改成gbk, 我之前尝试修改成utf8,结果在mysql中文还是显示乱码,改成gbk之后显示才正常)

[mysql]

default-character-set=gbk

...

# The default character set that will be used when a new schema or table is

# created and no character set is defined

default-character-set=gbk

修改完之后,重启mysql 服务,然后删除之前创建的库,重新创建新的库和表(创建库时指定编码:create database dbname default charset GBK (如果在my.ini文件中已经设置过新的编码格式,“default charset GBK” 可以不用写) ),创建好之后可以查看所建库的编码格式 mysql>:show create database dbname ;和查看表的编码格式:mysql>:show create table tablename

如果不想重建库不想重建表,可以对已经创建好的库和表的编码格式进行修改,

修改方式:

2.修改库的编码: ALTER DATABASE dbname DEFAULT CHARACTER SET gbk
3.修改表的编码:ALTER TABLE `testtable` DEFAULT CHARACTER SET gbk
4.修改字段的编码: 
ALTER TABLE `tablename` CHANGE  `name` VARCHAR( 45 ) CHARACTER SET gbk
是将MYSQL数据库tablename表中 "name"的字段编码改能够该为gbk
另外要保证在页面中传入的数据编码格式与数据库中的编码格式保持一致。


STM32 | DMA配置和使用如此简单(超详细) DMA学习很难吗?其实DMA配置和使用如此简单!本文让你无论在DMA认识和理解上(抽象不抽象都有)还是在DMA配置和使用上有个彻彻底底的认识。文章包括寄存器和库函数讲解,省去你自行翻阅使用手册和固件库手册,点到点教会你DMA的配置和使用。 阅读详情

相关推荐

初识数据结构之入门必懂——线性表(顺序表)

本文将介绍数据结构中的线性表与线性表中最简单的结构——顺序表

m0_64705485的博客 920

java.sql.SQLException: Illegal mix of collations (latin1_swedish_ci,IMPLICIT) and (utf8_general_ci,C

java.sql.SQLException: Illegal mix of collations (latin1_swedish_ci,IMPLICIT) and (utf8_general_ci,COERCIBLE) for operation ‘=’,意思是说字符编码不一样,不能进行比较,也就是说数据库内部的编码都不一样,有的数据是latin1_swedish_ci,有的数据是utf8_gen...

weixin_43564627的博客 4174

储能变流器(Power Control System——PCS)设计原理

储能变流器(Power Control System——PCS)可控制蓄电池的充电和放电过程,进行交直流的变换,在无电网情况下可以直接为交流负荷供电。PCS 由 DC/AC 双向变流器、控制单元等构成。PCS 控制器通过通讯接收后台控制指令,根据功率指令的符号及大小控制变流器对电池进行充电或放电,实现对电网有功功率及无功功率的调节。 PCS 控制器通过 CAN 接口与 BMS 通讯,获取电池组状态信息,可实现对电池的保护性充放电,确保电池运行安全。   储能变流器(PCS)可控制蓄电池的充电和放电过程,进

Zhouengineer的博客 5万+

Illegal mix of collations (latin1_swedish_ci,IMPLICIT) and (utf8_general_ci,COERCIBLE) for operation

用show full columns from tablename 该语句查询下这个表的每个字段的编码,才发现这个表中 其中一个字段的编码是latin1_swedish_ci(这个字段是建表后手动加的),执行了下alter table tablename convert to character set utf8,把该表的所有字段 都设置成utf-8了,问题就解决了。这个错误,就是查询的sql编码 与 数据库 中的 表字段编码不一致导致的,改成一致就行了。这里要说的是,本人排查的时候发现的问题。

yhyhyh_的博客 754

Windows 11下用Ollama一键部署DeepSeek-R1大模型(附8B/14B版本选择建议)

本文详细介绍了在Windows 11环境下使用Ollama工具一键部署DeepSeek-R1大模型的完整指南,包括8B和14B版本的选择建议。通过硬件评估、安装配置、性能优化等步骤,帮助开发者高效实现本地部署,提升AI应用体验。

weixin_29079643的博客 284

保姆级教程:用SNAP处理哨兵一号数据,5步搞定城区范围提取(附江西晋城案例)

本文提供了一份详细的保姆级教程,介绍如何使用SNAP软件处理哨兵一号数据,通过5个关键步骤快速提取城区范围。以江西晋城为例,教程涵盖数据准备、预处理、核心处理流程、自动化搭建及成果分析,帮助用户轻松掌握SNAP操作技巧,适用于城市规划、环境监测等领域。

weixin_32535389的博客 459

java.sql.SQLException: Illegal mix of collations (latin1_swedish_ci,IMPLICIT) and (utf8_general_ci,...

java.sql.SQLException: Illegal mix of collations (latin1_swedish_ci,IMPLICIT) and (utf8_general_ci,COERCIBLE) for operation '=',意思是说字符编码不一样,不能进行比较,也就是说数据库内部的编码都不一样,有的数据是latin1_swedish_ci,有的数据是utf8_gen...

weixin_30906425的博客 736

ICC2:postmask ECO参考脚本

更多学习内容请关注「拾陆楼」知识星球。

m0_61544122的博客 890

解决"Illegal mix of collations (latin1_swedish_ci,IMPLICIT) and (utf8_general_ci,COERCIBLE)

原文:http://www.111cn.net/database/mysql/41922.htm 今天在用java与mysql数据库时发现Illegal mix of collations (latin1_swedish_ci,IMPLICIT) and (utf8_general_ci,COER错误提示,下面我们来看解决方法吧。 部署完项目,测试一下,诶,数据出来了 没有

wujingwen1111的专栏 6354

gurobi最新下载安装教程 2023.11

我下载的最新版gurobi支持python3.7-python3.11,这个序号与计算机硬件捆绑,一旦激活就会失效。运行激活码之后,产生的。如果既放置在了上面的默认搜索目录,又设置了。系统环境变量(不是用户环境变量),指向保存的目录和文件名(例如。高版本产生的许可文件兼容低版本。验证不会成功,学术许可不会激活。之后cmd进入命令行,cd进入gurobi所在的。,实测不到一小时即可审核完毕,获得对应的许可。如果学校的网关没有将本校的。系统环境变量指向不同的目录和文件,原厂无关,是学校网络的设置问题。

Cachel Wood的博客 2万+

华为OD机试真题 新系统2026-04-01 Python&JS 实现【勇攀数字高峰】

请你在给定的数字地形图中寻找登山路径,数字代表当前位置的海拔高度,要求从最低海拔出发,不断攀登,最终到达最高山峰。你需要寻找所有满足条件的登山路径。地图已经保证最低海拔和最高山峰都只有一个。

MISAYAONE的博客 878

解决Illegal mix of collations (latin1_swedish_ci,IMPLICIT) and (utf8_general_ci,COER

今天在用java与mysql数据库时发现Illegal mix of collations (latin1_swedish_ci,IMPLICIT) and (utf8_general_ci,COER错误提示,下面我们来看解决方法吧。 部署完项目,测试一下,诶,数据出来了 没有多大问题(暗舒一口气)。继续测吧,一点新建完了,报错了,看看什么错误 一看完了 java.sql.SQLExcepti...

weixin_30746117的博客 246

VB摄像头监控

该VB模块可对摄像头捕获的画面进行录像等,可在创建的窗口进行控制

Illegal mix of collations (latin1_swedish_ci,IMPLICIT) and (utf8_general_ci,COER

今天在用java与mysql数据库时发现Illegal mix of collations (latin1_swedish_ci,IMPLICIT) and (utf8_general_ci,COER错误提示,下面我们来看解决方法吧。 部署完项目,测试一下,诶,数据出来了 没有多大问题(暗舒一口气)。继续测吧,一点新建完了,报错了,看看什么错误 一看完了 java.sql.SQLExc

u013802203的博客 604

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

蓝牙模块HM-10手册

蓝牙模块HM-10手册,该手册对蓝牙模块HM-10进行了详细的介绍和使用方法以及一些AT指令。

报错:Illegal mix of collations

问题: 服务端报错:Error: ER_CANT_AGGREGATE_2COLLATIONS: Illegal mix of collations (latin1_swedish_ci,IMPLICIT) and (utf8_general_ci,COERCIBLE) for operation 原因 这个错误直白的翻译过来就是:2个字段的编码类型不一致造成的。 解决办法 这个时候我们首先要查看Mysql数据的字符集编码: SHOW VARIABLES LIKE '%character%'; 这

weixin_43825727的博客 9996

TMS_WebGMaps_1.9.8.0_Full_Source

TMS_WebGMaps_1.9.8.0_Full_Source 全源码 delphi cbuilder

解决MySQL字符集冲突引发的“Illegal mix of collations”错误

解决字符集冲突

uncle_ll的博客 3347

解决 Illegal mix of collations (latin1_swedish_ci,IMPLICIT) and (utf8_general_ci,COERCIBLE)

OperationalError: (1267, "Illegal mix of collations (latin1_swedish_ci,IMPLICIT) and (utf8_general_ci,COERCIBLE) for operation 'like'") 今天在系统里做了一个中文的检索,结果 就出现如上的错误提示,第一反应是数据库字符集的问题,那么就按照下面的步骤,一步一步来排查...

dqchouyang的专栏 6634

【MySQL】1267 - Illegal mix of collations (latin1_swedish_ci,IMPLICIT) and (utf8mb4_general_ci,COERCIB

1267 - Illegal mix of collations (latin1_swedish_ci,IMPLICIT) and (utf8mb4_general_ci,COERCIBLE) for operation ‘=’"

Trees__的博客 3525

解决Illegal mix of collations (latin1_swedish_ci,IMPLICIT) and (utf8_general_ci错误

错误本质原因:出现了两种字符集。1.SHOW VARIABLES LIKE 'character_set_%'; 查看一下 显示+--------------------------+----------------------------+| Variable_name | Value |+--------------------------+---------------...

weixin_33811539的博客 531

mysql错误:Illegal mix of collations (latin1_swedish_ci,IMPLICIT) and (utf8_general_ci,COERCIBLE)

为什么80%的码农都做不了架构师?>>> ...

weixin_33918114的博客 2056

Mysql字符编码导致的错误:Illegal mix of collations (latin1_swedish_ci) and (utf8_general_ci)

简介 今天在排查BUG的时候,dev环境和production环境代码一致,sql语句也没什么问题, 查看日志发现出现了Mysql字符集的问题 Error: ER_CANT_AGGREGATE_2COLLATIONS: Illegal mix of collations (latin1_swedish_ci,IMPLICIT) and (utf8_general_ci,COERCIBLE) for operation 'like' 查看Mysql字符集 直接写一个shell脚本吧 EOF简介 我自己的理

好好活着,因为我们会死很久... 682
上一篇: 需求说明文档之阅读人员分析,如何提高需求说明文档的读者认可度
下一篇: 怎样成为调试高手与编程高手
dw_java08
博客等级 码龄15年 122粉丝 66原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值
⌂ 换网址