While importing sql table getting error due to collation While importing sql table getting error due to collation database database

While importing sql table getting error due to collation


Remove length (6) from datetime(6).

So your query would look something like this,

CREATE TABLE IF NOT EXISTS `blogs` (  `blog_id` int(10) NOT NULL AUTO_INCREMENT,  `blog_title` text NOT NULL,  `blog_content` text NOT NULL,  `created_on` datetime NOT NULL,  `created_by` int(20) NOT NULL,  `updated_on` datetime NOT NULL,  `updated_by` int(20) NOT NULL,  PRIMARY KEY (`blog_id`)) Engine=InnoDB  AUTO_INCREMENT=14 ;


You can not specify length attribute to datetime column:

CREATE TABLE IF NOT EXISTS `blogs` (  `blog_id` int(10) NOT NULL AUTO_INCREMENT,  `blog_title` text NOT NULL,  `blog_content` text NOT NULL,  `created_on` datetime NOT NULL,  `created_by` int(20) NOT NULL,  `updated_on` datetime NOT NULL,  `updated_by` int(20) NOT NULL,  PRIMARY KEY (`blog_id`)) Engine=InnoDB  AUTO_INCREMENT=14 ;


Don't set length in datetime .Just use it as

CREATE TABLE IF NOT EXISTS `blogs` (  `blog_id` int(10) NOT NULL AUTO_INCREMENT,  `blog_title` text NOT NULL,  `blog_content` text NOT NULL,  `created_on` datetime NOT NULL,// remove length here  `created_by` int(20) NOT NULL,  `updated_on` datetime NOT NULL,// remove length here  `updated_by` int(20) NOT NULL,  PRIMARY KEY (`blog_id`))Engine=InnoDB  AUTO_INCREMENT=14