S
S
sbh2016-08-04 04:47:01
MySQL
sbh, 2016-08-04 04:47:01

Why does an error occur when uploading a dump to the database?

Installing CRM.
Created an empty database.
I upload the base dump from the installation package to the base and get an error.
I upload it like this:
mysql -uroot -p dbname < db_dump.sql
Dump piece with the line on which the error occurs
DROP TABLE IF EXISTS `salesman_activities`;#%%
CREATE TABLE `salesman_activities` (
`id` int(11) NOT NULL auto_increment,
`title` varchar(20) NOT NULL,
`color` varchar(7) NOT NULL,
`resultat` text NOT NULL,
`isDefault` varchar(6) NOT NULL,
`aorder` int(5) NOT NULL,
`filter` varchar(255) DEFAULT 'all' NOT NULL,
`identity` int(30) DEFAULT '1' NOT NULL,
PRIMARY KEY (`id`),
KEY `title` (`title`),
KEY `identity` (`identity`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;#%%
INSERT INTO `salesman_activities` VALUES ('1','out.1.call', "#009900
" ,'Fax','#cc00cc','Sent and received;Sent;Not answering;Not receiving','','1','all','1');#%%
INSERT INTO `salesman_activities` VALUES ( '3','Meeting','#993366','Happened;Rescheduled;Cancelled;No longer needed','','2','all','1');#%%
INSERT INTO `salesman_activities` VALUES ('4','Task','#ff9900','Not done;Rescheduled;Deferred;Done','','3','all','1');#%%
INSERT INTO `salesman_activities` VALUES ('5','Offer','#ff0000','Transfer;Sent PO;Canceled','','4','all','1');#%%
INSERT INTO `salesman_activities` VALUES ('6','Event','#666699','Done;Transfer;Delayed','','5','all','1');#%%
INSERT INTO `salesman_activities` VALUES ('7','out.Mail','#0000ff','Commission sent;Contract sent;Presentation sent;Information sent','','6','all','1');#%%
INSERT INTO `salesman_activities` VALUES ('8','in.call','#99cc00','New contact;Invoice request;CO request;Invitation;Agreed to meet','','7','all','1');#%%
INSERT INTO `salesman_activities` VALUES ('9','in.Mail','#cc3300','','','8','all','1');# %%
INSERT INTO `salesman_activities` VALUES ('10','Congratulations','#009999','New Year;Birthday;Holiday','','9','all','1');#%%
INSERT INTO `salesman_activities` VALUES ('11','out.2.Call','#339966','Didn't get through;Out of office;Rejection;We talked;Request quotation','yes','10','all' ,'1');#%%
INSERT INTO `salesman_activities` VALUES ('12','Sending quotation','#ff0000','Sent;Moved;Delayed;Cancelled','','11','all' ,'1');#%%
String that caused the error:
INSERT INTO `salesman_activities` VALUES ('1','out.1.Call','#009900','Did not get through;Out of office;Rejection; Negotiated;Request KP','','0','all','1');#%%
Error text:
ERROR 1406 (22001) at line 16: Data too long for column 'title' at row 1

Answer the question

In order to leave comments, you need to log in

2 answer(s)
C
CityCat4, 2016-08-04
@sbh

With UTF-8 encoding, one character counts as two, so VARCHAR(20) will not be enough :) If you meant a 20-character field where non-ASCII text will be entered, then the field length must be doubled.

Z
zapimir, 2016-08-05
@zapimir

The problem is most likely due to incorrect connection encoding. The connection encoding is obviously set to latin1 by default, i.e. MySQL expects the data to arrive in latin1, but it arrives in UTF-8, as a result, Russian letters become "crazy" ( here it is described here ), and from one letter it becomes 2.
You can fix the situation by adding the line to the beginning of the dump
SET NAMES 'utf8';

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question