MySQL problem when I run install.sql against new DB












1















I'm trying to import an sql file to a new MySQL database, but get error:




ERROR 1265 (01000) at line 65: Data truncated for column 'for_PlayerPlayerActions' at row 1




I have zero MySQL knowledge to be honest.



I've been using the url https://bitbucket.org/Maverick_of_UC/hlstatsx-community-edition/wiki/Install which allows to me to run a stats site for a gaming server. I had it all running on a Windows 2003 (MySQL & IIS) server for years, but have rebuilt the server on Windows 2012R2 and I can't run the install.sql file against the database called hlstatsx.



Log into MySQL



mysql> create database hlstatsx;


Then in a command prompt:



C:hlstatsxsql>mysql -uroot -p hlstatsx < install.sql
Enter password: *********
ERROR 1265 (01000) at line 65: Data truncated for column
'for_PlayerPlayerActions' at row 1


if I open install.sql in Notepad++:



CREATE TABLE IF NOT EXISTS `hlstats_Actions` (
`id` int(10) unsigned NOT NULL auto_increment,
`game` varchar(32) NOT NULL default 'valve',
`code` varchar(64) NOT NULL default '',
`reward_player` int(11) NOT NULL default '10',
`reward_team` int(11) NOT NULL default '0',
`team` varchar(64) NOT NULL default '',
`description` varchar(128) default NULL,
`for_PlayerActions` enum('0','1') NOT NULL default '0',
`for_PlayerPlayerActions` enum('0','1') NOT NULL default '0',
`for_TeamActions` enum('0','1') NOT NULL default '0',
`for_WorldActions` enum('0','1') NOT NULL default '0',
`count` int(10) unsigned NOT NULL default '0',
PRIMARY KEY (`id`),
UNIQUE KEY `gamecode` (`code`,`game`,`team`),
KEY `code` (`code`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

--
-- Dumping data for table `hlstats_Actions`
--


and go to line 65 I see:



INSERT INTO `hlstats_Actions` (`game`, `code`, `reward_player`, `reward_team`, `team`, `description`, `for_PlayerActions`, `for_PlayerPlayerActions`, `for_TeamActions`, `for_WorldActions`) VALUES
('tf', 'flagevent_defended', 1, 0, '', 'Defended the flag', '1', '', '', ''),
('tf', 'flagevent_captured', 5, 1, '', 'Captured the flag', '1', '', '', ''),
('tf', 'flagevent_dropped', -2, 0, '', 'Dropped the flag (while alive)', '1', '', '', ''),
...


I got this all working years ago but took no notes, any ideas?



Thanks










share|improve this question

























  • how is for_PlayerPlayerActions defined inthe database? You show us the INSERT but not the CREATE TABLE that would define the column's max size ( which could have changed across mysql releases)

    – Dan Farrell
    Dec 31 '18 at 18:55











  • I've added it above, could it be something to do with the charset?

    – Gonzo
    Dec 31 '18 at 19:27











  • I don't see any reason to implicate charset. The column is an ENUM and can be 0 or 1. what is the value of for_PlayerPlayerActions in your insert?

    – Dan Farrell
    Dec 31 '18 at 19:34











  • Are you able to view the install.sql file here rather that me copy parts over? 1drv.ms/u/s!AiDwztGEAbFV_DK0gpBZBhsdHMtp

    – Gonzo
    Dec 31 '18 at 19:41













  • An admit for this DB has just replied saying "try to create database in utf8mb4_unicode_ci / utf8mb4_general_ci collation. Then import database from sql file." But didn't say how.

    – Gonzo
    Dec 31 '18 at 19:43
















1















I'm trying to import an sql file to a new MySQL database, but get error:




ERROR 1265 (01000) at line 65: Data truncated for column 'for_PlayerPlayerActions' at row 1




I have zero MySQL knowledge to be honest.



I've been using the url https://bitbucket.org/Maverick_of_UC/hlstatsx-community-edition/wiki/Install which allows to me to run a stats site for a gaming server. I had it all running on a Windows 2003 (MySQL & IIS) server for years, but have rebuilt the server on Windows 2012R2 and I can't run the install.sql file against the database called hlstatsx.



Log into MySQL



mysql> create database hlstatsx;


Then in a command prompt:



C:hlstatsxsql>mysql -uroot -p hlstatsx < install.sql
Enter password: *********
ERROR 1265 (01000) at line 65: Data truncated for column
'for_PlayerPlayerActions' at row 1


if I open install.sql in Notepad++:



CREATE TABLE IF NOT EXISTS `hlstats_Actions` (
`id` int(10) unsigned NOT NULL auto_increment,
`game` varchar(32) NOT NULL default 'valve',
`code` varchar(64) NOT NULL default '',
`reward_player` int(11) NOT NULL default '10',
`reward_team` int(11) NOT NULL default '0',
`team` varchar(64) NOT NULL default '',
`description` varchar(128) default NULL,
`for_PlayerActions` enum('0','1') NOT NULL default '0',
`for_PlayerPlayerActions` enum('0','1') NOT NULL default '0',
`for_TeamActions` enum('0','1') NOT NULL default '0',
`for_WorldActions` enum('0','1') NOT NULL default '0',
`count` int(10) unsigned NOT NULL default '0',
PRIMARY KEY (`id`),
UNIQUE KEY `gamecode` (`code`,`game`,`team`),
KEY `code` (`code`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

--
-- Dumping data for table `hlstats_Actions`
--


and go to line 65 I see:



INSERT INTO `hlstats_Actions` (`game`, `code`, `reward_player`, `reward_team`, `team`, `description`, `for_PlayerActions`, `for_PlayerPlayerActions`, `for_TeamActions`, `for_WorldActions`) VALUES
('tf', 'flagevent_defended', 1, 0, '', 'Defended the flag', '1', '', '', ''),
('tf', 'flagevent_captured', 5, 1, '', 'Captured the flag', '1', '', '', ''),
('tf', 'flagevent_dropped', -2, 0, '', 'Dropped the flag (while alive)', '1', '', '', ''),
...


I got this all working years ago but took no notes, any ideas?



Thanks










share|improve this question

























  • how is for_PlayerPlayerActions defined inthe database? You show us the INSERT but not the CREATE TABLE that would define the column's max size ( which could have changed across mysql releases)

    – Dan Farrell
    Dec 31 '18 at 18:55











  • I've added it above, could it be something to do with the charset?

    – Gonzo
    Dec 31 '18 at 19:27











  • I don't see any reason to implicate charset. The column is an ENUM and can be 0 or 1. what is the value of for_PlayerPlayerActions in your insert?

    – Dan Farrell
    Dec 31 '18 at 19:34











  • Are you able to view the install.sql file here rather that me copy parts over? 1drv.ms/u/s!AiDwztGEAbFV_DK0gpBZBhsdHMtp

    – Gonzo
    Dec 31 '18 at 19:41













  • An admit for this DB has just replied saying "try to create database in utf8mb4_unicode_ci / utf8mb4_general_ci collation. Then import database from sql file." But didn't say how.

    – Gonzo
    Dec 31 '18 at 19:43














1












1








1








I'm trying to import an sql file to a new MySQL database, but get error:




ERROR 1265 (01000) at line 65: Data truncated for column 'for_PlayerPlayerActions' at row 1




I have zero MySQL knowledge to be honest.



I've been using the url https://bitbucket.org/Maverick_of_UC/hlstatsx-community-edition/wiki/Install which allows to me to run a stats site for a gaming server. I had it all running on a Windows 2003 (MySQL & IIS) server for years, but have rebuilt the server on Windows 2012R2 and I can't run the install.sql file against the database called hlstatsx.



Log into MySQL



mysql> create database hlstatsx;


Then in a command prompt:



C:hlstatsxsql>mysql -uroot -p hlstatsx < install.sql
Enter password: *********
ERROR 1265 (01000) at line 65: Data truncated for column
'for_PlayerPlayerActions' at row 1


if I open install.sql in Notepad++:



CREATE TABLE IF NOT EXISTS `hlstats_Actions` (
`id` int(10) unsigned NOT NULL auto_increment,
`game` varchar(32) NOT NULL default 'valve',
`code` varchar(64) NOT NULL default '',
`reward_player` int(11) NOT NULL default '10',
`reward_team` int(11) NOT NULL default '0',
`team` varchar(64) NOT NULL default '',
`description` varchar(128) default NULL,
`for_PlayerActions` enum('0','1') NOT NULL default '0',
`for_PlayerPlayerActions` enum('0','1') NOT NULL default '0',
`for_TeamActions` enum('0','1') NOT NULL default '0',
`for_WorldActions` enum('0','1') NOT NULL default '0',
`count` int(10) unsigned NOT NULL default '0',
PRIMARY KEY (`id`),
UNIQUE KEY `gamecode` (`code`,`game`,`team`),
KEY `code` (`code`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

--
-- Dumping data for table `hlstats_Actions`
--


and go to line 65 I see:



INSERT INTO `hlstats_Actions` (`game`, `code`, `reward_player`, `reward_team`, `team`, `description`, `for_PlayerActions`, `for_PlayerPlayerActions`, `for_TeamActions`, `for_WorldActions`) VALUES
('tf', 'flagevent_defended', 1, 0, '', 'Defended the flag', '1', '', '', ''),
('tf', 'flagevent_captured', 5, 1, '', 'Captured the flag', '1', '', '', ''),
('tf', 'flagevent_dropped', -2, 0, '', 'Dropped the flag (while alive)', '1', '', '', ''),
...


I got this all working years ago but took no notes, any ideas?



Thanks










share|improve this question
















I'm trying to import an sql file to a new MySQL database, but get error:




ERROR 1265 (01000) at line 65: Data truncated for column 'for_PlayerPlayerActions' at row 1




I have zero MySQL knowledge to be honest.



I've been using the url https://bitbucket.org/Maverick_of_UC/hlstatsx-community-edition/wiki/Install which allows to me to run a stats site for a gaming server. I had it all running on a Windows 2003 (MySQL & IIS) server for years, but have rebuilt the server on Windows 2012R2 and I can't run the install.sql file against the database called hlstatsx.



Log into MySQL



mysql> create database hlstatsx;


Then in a command prompt:



C:hlstatsxsql>mysql -uroot -p hlstatsx < install.sql
Enter password: *********
ERROR 1265 (01000) at line 65: Data truncated for column
'for_PlayerPlayerActions' at row 1


if I open install.sql in Notepad++:



CREATE TABLE IF NOT EXISTS `hlstats_Actions` (
`id` int(10) unsigned NOT NULL auto_increment,
`game` varchar(32) NOT NULL default 'valve',
`code` varchar(64) NOT NULL default '',
`reward_player` int(11) NOT NULL default '10',
`reward_team` int(11) NOT NULL default '0',
`team` varchar(64) NOT NULL default '',
`description` varchar(128) default NULL,
`for_PlayerActions` enum('0','1') NOT NULL default '0',
`for_PlayerPlayerActions` enum('0','1') NOT NULL default '0',
`for_TeamActions` enum('0','1') NOT NULL default '0',
`for_WorldActions` enum('0','1') NOT NULL default '0',
`count` int(10) unsigned NOT NULL default '0',
PRIMARY KEY (`id`),
UNIQUE KEY `gamecode` (`code`,`game`,`team`),
KEY `code` (`code`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

--
-- Dumping data for table `hlstats_Actions`
--


and go to line 65 I see:



INSERT INTO `hlstats_Actions` (`game`, `code`, `reward_player`, `reward_team`, `team`, `description`, `for_PlayerActions`, `for_PlayerPlayerActions`, `for_TeamActions`, `for_WorldActions`) VALUES
('tf', 'flagevent_defended', 1, 0, '', 'Defended the flag', '1', '', '', ''),
('tf', 'flagevent_captured', 5, 1, '', 'Captured the flag', '1', '', '', ''),
('tf', 'flagevent_dropped', -2, 0, '', 'Dropped the flag (while alive)', '1', '', '', ''),
...


I got this all working years ago but took no notes, any ideas?



Thanks







mysql






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Dec 31 '18 at 19:43









Dan Farrell

6,11411417




6,11411417










asked Dec 31 '18 at 18:53









GonzoGonzo

93




93













  • how is for_PlayerPlayerActions defined inthe database? You show us the INSERT but not the CREATE TABLE that would define the column's max size ( which could have changed across mysql releases)

    – Dan Farrell
    Dec 31 '18 at 18:55











  • I've added it above, could it be something to do with the charset?

    – Gonzo
    Dec 31 '18 at 19:27











  • I don't see any reason to implicate charset. The column is an ENUM and can be 0 or 1. what is the value of for_PlayerPlayerActions in your insert?

    – Dan Farrell
    Dec 31 '18 at 19:34











  • Are you able to view the install.sql file here rather that me copy parts over? 1drv.ms/u/s!AiDwztGEAbFV_DK0gpBZBhsdHMtp

    – Gonzo
    Dec 31 '18 at 19:41













  • An admit for this DB has just replied saying "try to create database in utf8mb4_unicode_ci / utf8mb4_general_ci collation. Then import database from sql file." But didn't say how.

    – Gonzo
    Dec 31 '18 at 19:43



















  • how is for_PlayerPlayerActions defined inthe database? You show us the INSERT but not the CREATE TABLE that would define the column's max size ( which could have changed across mysql releases)

    – Dan Farrell
    Dec 31 '18 at 18:55











  • I've added it above, could it be something to do with the charset?

    – Gonzo
    Dec 31 '18 at 19:27











  • I don't see any reason to implicate charset. The column is an ENUM and can be 0 or 1. what is the value of for_PlayerPlayerActions in your insert?

    – Dan Farrell
    Dec 31 '18 at 19:34











  • Are you able to view the install.sql file here rather that me copy parts over? 1drv.ms/u/s!AiDwztGEAbFV_DK0gpBZBhsdHMtp

    – Gonzo
    Dec 31 '18 at 19:41













  • An admit for this DB has just replied saying "try to create database in utf8mb4_unicode_ci / utf8mb4_general_ci collation. Then import database from sql file." But didn't say how.

    – Gonzo
    Dec 31 '18 at 19:43

















how is for_PlayerPlayerActions defined inthe database? You show us the INSERT but not the CREATE TABLE that would define the column's max size ( which could have changed across mysql releases)

– Dan Farrell
Dec 31 '18 at 18:55





how is for_PlayerPlayerActions defined inthe database? You show us the INSERT but not the CREATE TABLE that would define the column's max size ( which could have changed across mysql releases)

– Dan Farrell
Dec 31 '18 at 18:55













I've added it above, could it be something to do with the charset?

– Gonzo
Dec 31 '18 at 19:27





I've added it above, could it be something to do with the charset?

– Gonzo
Dec 31 '18 at 19:27













I don't see any reason to implicate charset. The column is an ENUM and can be 0 or 1. what is the value of for_PlayerPlayerActions in your insert?

– Dan Farrell
Dec 31 '18 at 19:34





I don't see any reason to implicate charset. The column is an ENUM and can be 0 or 1. what is the value of for_PlayerPlayerActions in your insert?

– Dan Farrell
Dec 31 '18 at 19:34













Are you able to view the install.sql file here rather that me copy parts over? 1drv.ms/u/s!AiDwztGEAbFV_DK0gpBZBhsdHMtp

– Gonzo
Dec 31 '18 at 19:41







Are you able to view the install.sql file here rather that me copy parts over? 1drv.ms/u/s!AiDwztGEAbFV_DK0gpBZBhsdHMtp

– Gonzo
Dec 31 '18 at 19:41















An admit for this DB has just replied saying "try to create database in utf8mb4_unicode_ci / utf8mb4_general_ci collation. Then import database from sql file." But didn't say how.

– Gonzo
Dec 31 '18 at 19:43





An admit for this DB has just replied saying "try to create database in utf8mb4_unicode_ci / utf8mb4_general_ci collation. Then import database from sql file." But didn't say how.

– Gonzo
Dec 31 '18 at 19:43












1 Answer
1






active

oldest

votes


















0














Based on your table definition:



`for_PlayerPlayerActions` enum('0','1') NOT NULL default '0',


the column definition requires a value for that column and the data for that column you are attempting to load is a null/empty string.



Notice:



('tf', 'flagevent_defended', 1, 0, '', 'Defended the flag', '1', '', '', ''),


All those '' are empty strings/NULL and thus are outside the allowable range of the enum, which must be '0' or '1'.



It looks like you actually have a number of columns with the same problem. You can get around this problem in loading these, to remove the NOT NULL definition for the columns and rerun your sql script.



Afterwards, update all the NULL values for the columns in this table to 0 and then change the structure back and you should be fine with any dumps and loads in the future.



This likely occurred because NULLs were allowed for these columns at some point, or the table definition was added after rows existed prior to those columns being added.






share|improve this answer


























  • Thanks, I'm not an SQL chap so I think you are saying I need to edit the file and remove NOT NULLand re-run? The site that built this for other teams seem to have no issue running this though and my old server did. So I'm not sure why it's just me? I'm on MySQL 5.5 coudl it be the version?

    – Gonzo
    Dec 31 '18 at 20:11













  • Yes, remove the NOT NULL from those enum columns and should work. Regardless of what other sites might have experienced, it's your data that has the issue.

    – gview
    Dec 31 '18 at 20:22











  • I will try this. What I mean is the install.sql is a file everyone has been using to populate this new database, it's not my data. bitbucket.org/Maverick_of_UC/hlstatsx-community-edition/wiki/…

    – Gonzo
    Dec 31 '18 at 20:35











  • Well, again all I can say is that it's a simple and obvious issue with the data not matching the current table definition. Projects of all sorts have bugs and mistakes. It's also possible that there is an upgrade path you did not strictly follow that might have fixed this data in the past. If it was me, I would just fix it and move on since this is a one time installation.

    – gview
    Dec 31 '18 at 21:09











  • Importing it into MySQL in Linux worked, then exported it and imported into Windows MySQL again and it worked.

    – Gonzo
    Dec 31 '18 at 21:13











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53990568%2fmysql-problem-when-i-run-install-sql-against-new-db%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









0














Based on your table definition:



`for_PlayerPlayerActions` enum('0','1') NOT NULL default '0',


the column definition requires a value for that column and the data for that column you are attempting to load is a null/empty string.



Notice:



('tf', 'flagevent_defended', 1, 0, '', 'Defended the flag', '1', '', '', ''),


All those '' are empty strings/NULL and thus are outside the allowable range of the enum, which must be '0' or '1'.



It looks like you actually have a number of columns with the same problem. You can get around this problem in loading these, to remove the NOT NULL definition for the columns and rerun your sql script.



Afterwards, update all the NULL values for the columns in this table to 0 and then change the structure back and you should be fine with any dumps and loads in the future.



This likely occurred because NULLs were allowed for these columns at some point, or the table definition was added after rows existed prior to those columns being added.






share|improve this answer


























  • Thanks, I'm not an SQL chap so I think you are saying I need to edit the file and remove NOT NULLand re-run? The site that built this for other teams seem to have no issue running this though and my old server did. So I'm not sure why it's just me? I'm on MySQL 5.5 coudl it be the version?

    – Gonzo
    Dec 31 '18 at 20:11













  • Yes, remove the NOT NULL from those enum columns and should work. Regardless of what other sites might have experienced, it's your data that has the issue.

    – gview
    Dec 31 '18 at 20:22











  • I will try this. What I mean is the install.sql is a file everyone has been using to populate this new database, it's not my data. bitbucket.org/Maverick_of_UC/hlstatsx-community-edition/wiki/…

    – Gonzo
    Dec 31 '18 at 20:35











  • Well, again all I can say is that it's a simple and obvious issue with the data not matching the current table definition. Projects of all sorts have bugs and mistakes. It's also possible that there is an upgrade path you did not strictly follow that might have fixed this data in the past. If it was me, I would just fix it and move on since this is a one time installation.

    – gview
    Dec 31 '18 at 21:09











  • Importing it into MySQL in Linux worked, then exported it and imported into Windows MySQL again and it worked.

    – Gonzo
    Dec 31 '18 at 21:13
















0














Based on your table definition:



`for_PlayerPlayerActions` enum('0','1') NOT NULL default '0',


the column definition requires a value for that column and the data for that column you are attempting to load is a null/empty string.



Notice:



('tf', 'flagevent_defended', 1, 0, '', 'Defended the flag', '1', '', '', ''),


All those '' are empty strings/NULL and thus are outside the allowable range of the enum, which must be '0' or '1'.



It looks like you actually have a number of columns with the same problem. You can get around this problem in loading these, to remove the NOT NULL definition for the columns and rerun your sql script.



Afterwards, update all the NULL values for the columns in this table to 0 and then change the structure back and you should be fine with any dumps and loads in the future.



This likely occurred because NULLs were allowed for these columns at some point, or the table definition was added after rows existed prior to those columns being added.






share|improve this answer


























  • Thanks, I'm not an SQL chap so I think you are saying I need to edit the file and remove NOT NULLand re-run? The site that built this for other teams seem to have no issue running this though and my old server did. So I'm not sure why it's just me? I'm on MySQL 5.5 coudl it be the version?

    – Gonzo
    Dec 31 '18 at 20:11













  • Yes, remove the NOT NULL from those enum columns and should work. Regardless of what other sites might have experienced, it's your data that has the issue.

    – gview
    Dec 31 '18 at 20:22











  • I will try this. What I mean is the install.sql is a file everyone has been using to populate this new database, it's not my data. bitbucket.org/Maverick_of_UC/hlstatsx-community-edition/wiki/…

    – Gonzo
    Dec 31 '18 at 20:35











  • Well, again all I can say is that it's a simple and obvious issue with the data not matching the current table definition. Projects of all sorts have bugs and mistakes. It's also possible that there is an upgrade path you did not strictly follow that might have fixed this data in the past. If it was me, I would just fix it and move on since this is a one time installation.

    – gview
    Dec 31 '18 at 21:09











  • Importing it into MySQL in Linux worked, then exported it and imported into Windows MySQL again and it worked.

    – Gonzo
    Dec 31 '18 at 21:13














0












0








0







Based on your table definition:



`for_PlayerPlayerActions` enum('0','1') NOT NULL default '0',


the column definition requires a value for that column and the data for that column you are attempting to load is a null/empty string.



Notice:



('tf', 'flagevent_defended', 1, 0, '', 'Defended the flag', '1', '', '', ''),


All those '' are empty strings/NULL and thus are outside the allowable range of the enum, which must be '0' or '1'.



It looks like you actually have a number of columns with the same problem. You can get around this problem in loading these, to remove the NOT NULL definition for the columns and rerun your sql script.



Afterwards, update all the NULL values for the columns in this table to 0 and then change the structure back and you should be fine with any dumps and loads in the future.



This likely occurred because NULLs were allowed for these columns at some point, or the table definition was added after rows existed prior to those columns being added.






share|improve this answer















Based on your table definition:



`for_PlayerPlayerActions` enum('0','1') NOT NULL default '0',


the column definition requires a value for that column and the data for that column you are attempting to load is a null/empty string.



Notice:



('tf', 'flagevent_defended', 1, 0, '', 'Defended the flag', '1', '', '', ''),


All those '' are empty strings/NULL and thus are outside the allowable range of the enum, which must be '0' or '1'.



It looks like you actually have a number of columns with the same problem. You can get around this problem in loading these, to remove the NOT NULL definition for the columns and rerun your sql script.



Afterwards, update all the NULL values for the columns in this table to 0 and then change the structure back and you should be fine with any dumps and loads in the future.



This likely occurred because NULLs were allowed for these columns at some point, or the table definition was added after rows existed prior to those columns being added.







share|improve this answer














share|improve this answer



share|improve this answer








edited Dec 31 '18 at 20:01

























answered Dec 31 '18 at 19:56









gviewgview

11.2k22639




11.2k22639













  • Thanks, I'm not an SQL chap so I think you are saying I need to edit the file and remove NOT NULLand re-run? The site that built this for other teams seem to have no issue running this though and my old server did. So I'm not sure why it's just me? I'm on MySQL 5.5 coudl it be the version?

    – Gonzo
    Dec 31 '18 at 20:11













  • Yes, remove the NOT NULL from those enum columns and should work. Regardless of what other sites might have experienced, it's your data that has the issue.

    – gview
    Dec 31 '18 at 20:22











  • I will try this. What I mean is the install.sql is a file everyone has been using to populate this new database, it's not my data. bitbucket.org/Maverick_of_UC/hlstatsx-community-edition/wiki/…

    – Gonzo
    Dec 31 '18 at 20:35











  • Well, again all I can say is that it's a simple and obvious issue with the data not matching the current table definition. Projects of all sorts have bugs and mistakes. It's also possible that there is an upgrade path you did not strictly follow that might have fixed this data in the past. If it was me, I would just fix it and move on since this is a one time installation.

    – gview
    Dec 31 '18 at 21:09











  • Importing it into MySQL in Linux worked, then exported it and imported into Windows MySQL again and it worked.

    – Gonzo
    Dec 31 '18 at 21:13



















  • Thanks, I'm not an SQL chap so I think you are saying I need to edit the file and remove NOT NULLand re-run? The site that built this for other teams seem to have no issue running this though and my old server did. So I'm not sure why it's just me? I'm on MySQL 5.5 coudl it be the version?

    – Gonzo
    Dec 31 '18 at 20:11













  • Yes, remove the NOT NULL from those enum columns and should work. Regardless of what other sites might have experienced, it's your data that has the issue.

    – gview
    Dec 31 '18 at 20:22











  • I will try this. What I mean is the install.sql is a file everyone has been using to populate this new database, it's not my data. bitbucket.org/Maverick_of_UC/hlstatsx-community-edition/wiki/…

    – Gonzo
    Dec 31 '18 at 20:35











  • Well, again all I can say is that it's a simple and obvious issue with the data not matching the current table definition. Projects of all sorts have bugs and mistakes. It's also possible that there is an upgrade path you did not strictly follow that might have fixed this data in the past. If it was me, I would just fix it and move on since this is a one time installation.

    – gview
    Dec 31 '18 at 21:09











  • Importing it into MySQL in Linux worked, then exported it and imported into Windows MySQL again and it worked.

    – Gonzo
    Dec 31 '18 at 21:13

















Thanks, I'm not an SQL chap so I think you are saying I need to edit the file and remove NOT NULLand re-run? The site that built this for other teams seem to have no issue running this though and my old server did. So I'm not sure why it's just me? I'm on MySQL 5.5 coudl it be the version?

– Gonzo
Dec 31 '18 at 20:11







Thanks, I'm not an SQL chap so I think you are saying I need to edit the file and remove NOT NULLand re-run? The site that built this for other teams seem to have no issue running this though and my old server did. So I'm not sure why it's just me? I'm on MySQL 5.5 coudl it be the version?

– Gonzo
Dec 31 '18 at 20:11















Yes, remove the NOT NULL from those enum columns and should work. Regardless of what other sites might have experienced, it's your data that has the issue.

– gview
Dec 31 '18 at 20:22





Yes, remove the NOT NULL from those enum columns and should work. Regardless of what other sites might have experienced, it's your data that has the issue.

– gview
Dec 31 '18 at 20:22













I will try this. What I mean is the install.sql is a file everyone has been using to populate this new database, it's not my data. bitbucket.org/Maverick_of_UC/hlstatsx-community-edition/wiki/…

– Gonzo
Dec 31 '18 at 20:35





I will try this. What I mean is the install.sql is a file everyone has been using to populate this new database, it's not my data. bitbucket.org/Maverick_of_UC/hlstatsx-community-edition/wiki/…

– Gonzo
Dec 31 '18 at 20:35













Well, again all I can say is that it's a simple and obvious issue with the data not matching the current table definition. Projects of all sorts have bugs and mistakes. It's also possible that there is an upgrade path you did not strictly follow that might have fixed this data in the past. If it was me, I would just fix it and move on since this is a one time installation.

– gview
Dec 31 '18 at 21:09





Well, again all I can say is that it's a simple and obvious issue with the data not matching the current table definition. Projects of all sorts have bugs and mistakes. It's also possible that there is an upgrade path you did not strictly follow that might have fixed this data in the past. If it was me, I would just fix it and move on since this is a one time installation.

– gview
Dec 31 '18 at 21:09













Importing it into MySQL in Linux worked, then exported it and imported into Windows MySQL again and it worked.

– Gonzo
Dec 31 '18 at 21:13





Importing it into MySQL in Linux worked, then exported it and imported into Windows MySQL again and it worked.

– Gonzo
Dec 31 '18 at 21:13




















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53990568%2fmysql-problem-when-i-run-install-sql-against-new-db%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Monofisismo

Angular Downloading a file using contenturl with Basic Authentication

Olmecas