Error 1067: Invalid default value for created_at











up vote
-1
down vote

favorite












Im trying to import my sql file backup to my new server, but i receive error:



Error 1067: Invalid default value for created_at



this is my SQL file header:



-- phpMyAdmin SQL Dump
-- version 4.8.3
-- https://www.phpmyadmin.net/
--
-- Host: localhost:3306
-- Generation Time: Nov 07, 2018 at 07:43 AM
-- Server version: 5.7.24
-- PHP Version: 7.2.7

SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET AUTOCOMMIT = 0;
START TRANSACTION;
SET time_zone = "+00:00";


/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;

--
-- Database: `.....


Error:



error



i added sql_mode line inside the conf file at:
/etc/mysql/my.cnf



ddl



restart mysql and apache2, but still not resolved



any idea please?










share|improve this question




















  • 1




    What is your MySQL version ? Current_Timestamp is not supported by older versions
    – Madhur Bhaiya
    Nov 7 at 13:47










  • Server version: 5.5.62-0ubuntu0.14.04.1 - (Ubuntu)
    – rilucu
    Nov 7 at 13:50










  • it will be better to go with mysql 8 and ubuntu 18?
    – rilucu
    Nov 7 at 13:56

















up vote
-1
down vote

favorite












Im trying to import my sql file backup to my new server, but i receive error:



Error 1067: Invalid default value for created_at



this is my SQL file header:



-- phpMyAdmin SQL Dump
-- version 4.8.3
-- https://www.phpmyadmin.net/
--
-- Host: localhost:3306
-- Generation Time: Nov 07, 2018 at 07:43 AM
-- Server version: 5.7.24
-- PHP Version: 7.2.7

SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET AUTOCOMMIT = 0;
START TRANSACTION;
SET time_zone = "+00:00";


/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;

--
-- Database: `.....


Error:



error



i added sql_mode line inside the conf file at:
/etc/mysql/my.cnf



ddl



restart mysql and apache2, but still not resolved



any idea please?










share|improve this question




















  • 1




    What is your MySQL version ? Current_Timestamp is not supported by older versions
    – Madhur Bhaiya
    Nov 7 at 13:47










  • Server version: 5.5.62-0ubuntu0.14.04.1 - (Ubuntu)
    – rilucu
    Nov 7 at 13:50










  • it will be better to go with mysql 8 and ubuntu 18?
    – rilucu
    Nov 7 at 13:56















up vote
-1
down vote

favorite









up vote
-1
down vote

favorite











Im trying to import my sql file backup to my new server, but i receive error:



Error 1067: Invalid default value for created_at



this is my SQL file header:



-- phpMyAdmin SQL Dump
-- version 4.8.3
-- https://www.phpmyadmin.net/
--
-- Host: localhost:3306
-- Generation Time: Nov 07, 2018 at 07:43 AM
-- Server version: 5.7.24
-- PHP Version: 7.2.7

SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET AUTOCOMMIT = 0;
START TRANSACTION;
SET time_zone = "+00:00";


/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;

--
-- Database: `.....


Error:



error



i added sql_mode line inside the conf file at:
/etc/mysql/my.cnf



ddl



restart mysql and apache2, but still not resolved



any idea please?










share|improve this question















Im trying to import my sql file backup to my new server, but i receive error:



Error 1067: Invalid default value for created_at



this is my SQL file header:



-- phpMyAdmin SQL Dump
-- version 4.8.3
-- https://www.phpmyadmin.net/
--
-- Host: localhost:3306
-- Generation Time: Nov 07, 2018 at 07:43 AM
-- Server version: 5.7.24
-- PHP Version: 7.2.7

SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET AUTOCOMMIT = 0;
START TRANSACTION;
SET time_zone = "+00:00";


/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;

--
-- Database: `.....


Error:



error



i added sql_mode line inside the conf file at:
/etc/mysql/my.cnf



ddl



restart mysql and apache2, but still not resolved



any idea please?







mysql






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 7 at 13:50









O. Jones

58.6k971106




58.6k971106










asked Nov 7 at 13:46









rilucu

13




13








  • 1




    What is your MySQL version ? Current_Timestamp is not supported by older versions
    – Madhur Bhaiya
    Nov 7 at 13:47










  • Server version: 5.5.62-0ubuntu0.14.04.1 - (Ubuntu)
    – rilucu
    Nov 7 at 13:50










  • it will be better to go with mysql 8 and ubuntu 18?
    – rilucu
    Nov 7 at 13:56
















  • 1




    What is your MySQL version ? Current_Timestamp is not supported by older versions
    – Madhur Bhaiya
    Nov 7 at 13:47










  • Server version: 5.5.62-0ubuntu0.14.04.1 - (Ubuntu)
    – rilucu
    Nov 7 at 13:50










  • it will be better to go with mysql 8 and ubuntu 18?
    – rilucu
    Nov 7 at 13:56










1




1




What is your MySQL version ? Current_Timestamp is not supported by older versions
– Madhur Bhaiya
Nov 7 at 13:47




What is your MySQL version ? Current_Timestamp is not supported by older versions
– Madhur Bhaiya
Nov 7 at 13:47












Server version: 5.5.62-0ubuntu0.14.04.1 - (Ubuntu)
– rilucu
Nov 7 at 13:50




Server version: 5.5.62-0ubuntu0.14.04.1 - (Ubuntu)
– rilucu
Nov 7 at 13:50












it will be better to go with mysql 8 and ubuntu 18?
– rilucu
Nov 7 at 13:56






it will be better to go with mysql 8 and ubuntu 18?
– rilucu
Nov 7 at 13:56














1 Answer
1






active

oldest

votes

















up vote
0
down vote



accepted










Colums with the CURRENT_TIMESTAMP attribute must have the data type TIMESTAMP, not DATETIME, in MySQL versions prior to 5.6.



So you need



`created_at` TIMESTAMP DEFAULT CURRENT_TIMESTAMP


or a later version of MySQL.






share|improve this answer





















  • ubuntu 18 and mysql 8 will fix it without to edit the sql?
    – rilucu
    Nov 7 at 13:58










  • by the way, it fixed the problem thank you very much:) i edited the lines to TIMESTAMP and now its fine.
    – rilucu
    Nov 7 at 14:04












  • The operating system version doesn't matter. Any MySQL version 5.6.4 or better will deal with this problem, as will changing the column definition.
    – O. Jones
    Nov 7 at 15:57











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',
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%2f53190722%2ferror-1067-invalid-default-value-for-created-at%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








up vote
0
down vote



accepted










Colums with the CURRENT_TIMESTAMP attribute must have the data type TIMESTAMP, not DATETIME, in MySQL versions prior to 5.6.



So you need



`created_at` TIMESTAMP DEFAULT CURRENT_TIMESTAMP


or a later version of MySQL.






share|improve this answer





















  • ubuntu 18 and mysql 8 will fix it without to edit the sql?
    – rilucu
    Nov 7 at 13:58










  • by the way, it fixed the problem thank you very much:) i edited the lines to TIMESTAMP and now its fine.
    – rilucu
    Nov 7 at 14:04












  • The operating system version doesn't matter. Any MySQL version 5.6.4 or better will deal with this problem, as will changing the column definition.
    – O. Jones
    Nov 7 at 15:57















up vote
0
down vote



accepted










Colums with the CURRENT_TIMESTAMP attribute must have the data type TIMESTAMP, not DATETIME, in MySQL versions prior to 5.6.



So you need



`created_at` TIMESTAMP DEFAULT CURRENT_TIMESTAMP


or a later version of MySQL.






share|improve this answer





















  • ubuntu 18 and mysql 8 will fix it without to edit the sql?
    – rilucu
    Nov 7 at 13:58










  • by the way, it fixed the problem thank you very much:) i edited the lines to TIMESTAMP and now its fine.
    – rilucu
    Nov 7 at 14:04












  • The operating system version doesn't matter. Any MySQL version 5.6.4 or better will deal with this problem, as will changing the column definition.
    – O. Jones
    Nov 7 at 15:57













up vote
0
down vote



accepted







up vote
0
down vote



accepted






Colums with the CURRENT_TIMESTAMP attribute must have the data type TIMESTAMP, not DATETIME, in MySQL versions prior to 5.6.



So you need



`created_at` TIMESTAMP DEFAULT CURRENT_TIMESTAMP


or a later version of MySQL.






share|improve this answer












Colums with the CURRENT_TIMESTAMP attribute must have the data type TIMESTAMP, not DATETIME, in MySQL versions prior to 5.6.



So you need



`created_at` TIMESTAMP DEFAULT CURRENT_TIMESTAMP


or a later version of MySQL.







share|improve this answer












share|improve this answer



share|improve this answer










answered Nov 7 at 13:56









O. Jones

58.6k971106




58.6k971106












  • ubuntu 18 and mysql 8 will fix it without to edit the sql?
    – rilucu
    Nov 7 at 13:58










  • by the way, it fixed the problem thank you very much:) i edited the lines to TIMESTAMP and now its fine.
    – rilucu
    Nov 7 at 14:04












  • The operating system version doesn't matter. Any MySQL version 5.6.4 or better will deal with this problem, as will changing the column definition.
    – O. Jones
    Nov 7 at 15:57


















  • ubuntu 18 and mysql 8 will fix it without to edit the sql?
    – rilucu
    Nov 7 at 13:58










  • by the way, it fixed the problem thank you very much:) i edited the lines to TIMESTAMP and now its fine.
    – rilucu
    Nov 7 at 14:04












  • The operating system version doesn't matter. Any MySQL version 5.6.4 or better will deal with this problem, as will changing the column definition.
    – O. Jones
    Nov 7 at 15:57
















ubuntu 18 and mysql 8 will fix it without to edit the sql?
– rilucu
Nov 7 at 13:58




ubuntu 18 and mysql 8 will fix it without to edit the sql?
– rilucu
Nov 7 at 13:58












by the way, it fixed the problem thank you very much:) i edited the lines to TIMESTAMP and now its fine.
– rilucu
Nov 7 at 14:04






by the way, it fixed the problem thank you very much:) i edited the lines to TIMESTAMP and now its fine.
– rilucu
Nov 7 at 14:04














The operating system version doesn't matter. Any MySQL version 5.6.4 or better will deal with this problem, as will changing the column definition.
– O. Jones
Nov 7 at 15:57




The operating system version doesn't matter. Any MySQL version 5.6.4 or better will deal with this problem, as will changing the column definition.
– O. Jones
Nov 7 at 15:57


















 

draft saved


draft discarded



















































 


draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53190722%2ferror-1067-invalid-default-value-for-created-at%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







這個網誌中的熱門文章

Tangent Lines Diagram Along Smooth Curve

Yusuf al-Mu'taman ibn Hud

Zucchini