#1005 - Can't create table TABLE NAME' (errno: 150) (Details…) - mysql

I have deleted the user table and now wanted to impotieren another user table of the same forensoftware.
But it does not work
I Add SQL Backup Table
https://pastebin.com/uZjbUFEk
This Error Comming on PHPmyAdmin
CREATE TABLE `wcf1_user` (
`userID` int(10) NOT NULL,
`username` varchar(255) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
`email` varchar(255) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
`password` varchar(100) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
`accessToken` char(40) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
`languageID` int(10) NOT NULL DEFAULT '0',
`registrationDate` int(10) NOT NULL DEFAULT '0',
`styleID` int(10) NOT NULL DEFAULT '0',
`banned` tinyint(1) NOT NULL DEFAULT '0',
`banReason` mediumtext COLLATE utf8_unicode_ci,
`banExpires` int(10) NOT NULL DEFAULT '0',
`activationCode` int(10) NOT NULL DEFAULT '0',
`lastLostPasswordRequestTime` int(10) NOT NULL DEFAULT '0',
`lostPasswordKey` varchar(40) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
`lastUsernameChange`[...]
#1005 - Can't create table 'censored.wcf1_user' (errno: 150) (Details…)

Related

Migrating an .sql database to WordPress

I have an SQL file for a database from an old custom blog CMS. I am trying to import the articles into WordPress but I am now stuck. So far, I have managed to isolate the table structures for the CMS (see below). I have also identified the columns that i need. These are (Post, Title, Date, Image, Category). Now I have to map these columns to some columns in the Wordpress schema somehow and that is where I am getting stuck.
Here is the SQL structure of the database:
CREATE TABLE `ads_ng_ads` (
`id` int(10) unsigned NOT NULL auto_increment,
`ad_type` enum('media','text','html') character set latin1 collate latin1_bin NOT NULL,
`media_type` enum('image','flash','other') character set latin1 collate latin1_bin default NULL,
`media_width` smallint(6) default NULL,
`media_height` smallint(6) default NULL,
`media_size` int(6) default NULL,
`media_path` varchar(128) character set latin1 collate latin1_bin default NULL,
`uri` varchar(128) character set utf8 collate utf8_bin NOT NULL,
`is_hidden` tinyint(1) NOT NULL,
`created_on` int(11) NOT NULL,
`active_from` int(11) NOT NULL,
`active_to` int(11) NOT NULL,
`room_id` int(11) default NULL,
`geo_target` int(11) default NULL,
`alternative` text character set utf8 NOT NULL,
`zone_target` text character set ascii collate ascii_bin NOT NULL,
`uri_target` text character set utf8 collate utf8_bin NOT NULL,
PRIMARY KEY (`id`),
KEY `zone_target` (`is_hidden`,`active_from`,`active_to`,`geo_target`)
) ENGINE=MyISAM AUTO_INCREMENT=757 DEFAULT CHARSET=latin1;
CREATE TABLE `ads_ng_statistics` (
`ad_id` int(10) unsigned NOT NULL,
`date` int(11) NOT NULL,
`views` mediumint(8) unsigned NOT NULL default '0',
`clicks` mediumint(8) unsigned NOT NULL default '0',
PRIMARY KEY (`ad_id`,`date`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
CREATE TABLE `countries` (
`id` int(11) NOT NULL auto_increment,
`name` varchar(100) NOT NULL,
`alias` varchar(3) NOT NULL,
`restricted` tinyint(3) NOT NULL default '0',
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=253 DEFAULT CHARSET=utf8;
CREATE TABLE `featured_column` (
`id` int(11) unsigned NOT NULL auto_increment,
`date_modified` timestamp NOT NULL default CURRENT_TIMESTAMP,
`date_created` timestamp NOT NULL default '1000-01-01 00:00:00',
`title` varchar(255) NOT NULL,
`alias` varchar(255) NOT NULL,
`body` text NOT NULL,
`body_html` text NOT NULL,
`user_id` int(11) NOT NULL,
`tags` varchar(255) NOT NULL,
`summary` varchar(255) NOT NULL,
`in_homepage` int(1) NOT NULL default '0',
`img_title` int(1) NOT NULL default '0',
`meta_t` varchar(255) NOT NULL,
`meta_k` varchar(255) NOT NULL,
`meta_d` varchar(255) NOT NULL,
`public` int(1) NOT NULL default '0',
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=1381 DEFAULT CHARSET=utf8;
Assuming that you're using the latest WordPress version(4.9.1), you just need to create a script that will import all data to table wp_posts for example if you want to import as WordPress posts. Example: "Title" to "post_title", "post" to "post_content", etc.

Error when importing to server

SQL query:
CREATE TABLE `wp_layerslider` (
`id` int(10) NOT NULL AUTO_INCREMENT,
`author` int(10) NOT NULL DEFAULT '0',
`name` varchar(100) COLLATE utf8mb4_unicode_520_ci DEFAULT '',
`slug` varchar(100) COLLATE utf8mb4_unicode_520_ci DEFAULT '',
`data` mediumtext COLLATE utf8mb4_unicode_520_ci NOT NULL,
`date_c` int(10) NOT NULL,
`date_m` int(10) NOT NULL,
`schedule_start` int(10) NOT NULL DEFAULT '0',
`schedule_end` int(10) NOT NULL DEFAULT '0',
`flag_hidden` tinyint(1) NOT NULL DEFAULT '0',
`flag_deleted` tinyint(1) NOT NULL DEFAULT '0',
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci;
MySQL said: Documentation
1273 - Unknown collation: 'utf8mb4_unicode_520_ci'
When attempting to import a database. I'm very new to all of this, hoping someone can assist in simple terms for me
could be you are using an oldeversion of mysql db .. and the collate you need is not avialable .. you could use try alter the table or change the collate
ALTER TABLE `wp_layerslider` CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci

multiple joins SQL query optimization

I have the following query :
SELECT
COUNT(DISTINCT a0_.id) AS sclr0
FROM
account a0_
INNER JOIN customer c1_ ON (c1_.account = a0_.id)
LEFT JOIN sf_user_data s2_ ON (s2_.user_id = a0_.id)
LEFT JOIN address a3_ ON (c1_.customer_address = a3_.id)
WHERE
a3_.city IS NOT NULL
resulting in the following output :
sclr0
+--------+
298279
with the following EXPLAIN :
id select_type table partitions type possible_keys key key_len ref rows filtered Extra
+--+---------------+-------+-----------+-------+--------------------------------------------+-----------------------+-----------+--------------------------------+-------+-----------+-------+
1 SIMPLE c1_ NULL ALL UNIQ_81398E097D3656A4,UNIQ_81398E091193CB3F NULL NULL NULL 405508 100.00 NULL
1 SIMPLE a0_ NULL eq_ref PRIMARY PRIMARY 8 evoportail.c1_.account 1 100.00 Using index
1 SIMPLE s2_ NULL eq_ref UNIQ_E904BFD1A76ED395 UNIQ_E904BFD1A76ED395 8 evoportail.c1_.account 1 100.00 Using index
1 SIMPLE a3_ NULL eq_ref PRIMARY PRIMARY 8 evoportail.c1_.customer_address 1 90.00 Using where
approximative number of rows in the tables :
account : 430000
customer: 430000
sf_user_data : 115000
address : 550000
Right now, this query is running in 3 seconds. Is there any way to speed it up ?
the CREATE statements :
CREATE TABLE `account` (
`id` bigint(20) unsigned NOT NULL auto_increment,
`identifier` varchar(255) collate utf8_bin NOT NULL,
`hash` varchar(255) collate utf8_bin default NULL,
`date_create` datetime default NULL,
`group` varchar(50) collate utf8_bin default NULL,
`sub_group` varchar(50) collate utf8_bin NOT NULL default 'NULL',
`date_last_action` datetime default NULL,
`date_last_connection` datetime default NULL,
`connection_counter` int(10) unsigned default NULL,
`connection_since_customer` int(10) unsigned NOT NULL default '0',
`salt` varchar(255) collate utf8_bin default NULL,
`roles` longtext collate utf8_bin COMMENT '(DC2Type:array)',
`is_v3` tinyint(1) NOT NULL default '1',
`password_token` varchar(255) collate utf8_bin default NULL,
`password_token_expired_at` datetime default NULL,
`is_included_in_newsletters` tinyint(1) NOT NULL default '0',
PRIMARY KEY (`id`),
UNIQUE KEY `identifier_UNIQUE` (`identifier`)
) ENGINE=MyISAM AUTO_INCREMENT=434243 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
CREATE TABLE `address` (
`id` bigint(20) unsigned NOT NULL auto_increment,
`city` varchar(64) collate utf8_bin default NULL,
`street` varchar(255) collate utf8_bin default NULL,
`complement` varchar(128) collate utf8_bin default NULL,
`zipcode` varchar(16) collate utf8_bin default NULL,
`country_id` int(11) default NULL,
`cedex` tinyint(1) NOT NULL default '0',
`abroad` tinyint(1) NOT NULL default '0',
PRIMARY KEY (`id`),
KEY `IDX_D4E6F81F92F3E70` (`country_id`)
) ENGINE=MyISAM AUTO_INCREMENT=541873 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
CREATE TABLE `customer` (
`id` bigint(20) unsigned NOT NULL auto_increment,
`account` bigint(20) unsigned NOT NULL,
`source` varchar(250) collate utf8_bin NOT NULL default 'DECLARATION',
`last_source` varchar(250) collate utf8_bin NOT NULL,
`source_domain_name` varchar(255) collate utf8_bin default NULL,
`subscription_offer` varchar(255) collate utf8_bin default NULL,
`formalities_center_address` bigint(20) unsigned default NULL,
`customer_address` bigint(20) unsigned default NULL,
`business_address` bigint(20) unsigned default NULL,
`shipping_address` bigint(20) default NULL,
`activity` text collate utf8_bin,
`state` enum('NONE','CREATE','UPDATE','COMPLETE') collate utf8_bin NOT NULL default 'NONE',
`num_dossier` varchar(255) collate utf8_bin default NULL,
`email` varchar(255) collate utf8_bin NOT NULL,
`lastname` varchar(255) collate utf8_bin NOT NULL,
`firstname` varchar(255) collate utf8_bin NOT NULL,
`sexe` int(1) NOT NULL default '0',
`activityset` int(1) NOT NULL default '0',
`phone` varchar(16) collate utf8_bin NOT NULL,
`business_name` varchar(255) collate utf8_bin default NULL,
`payment_method` enum('NONE','CB_OK','CB_KO','CHEQUE_OK','CHEQUE_KO','WAITING','IMPACTPLUS_OK','PRELEV') collate utf8_bin default 'NONE',
`payment_waiting_comment` text collate utf8_bin,
`sub_sent_recovery` smallint(6) default '0',
`transaction_number` varchar(30) collate utf8_bin default NULL,
`transaction_date` datetime default NULL,
`properties` set('ACCRE','CFE','WANT_WEBSITE','HAVE_WEBSITE','NEWSLETTER','SUBSCRIBE','OLD_CUSTOMER') collate utf8_bin default NULL,
`comments` text collate utf8_bin,
`activity_declaration` varchar(512) collate utf8_bin default NULL COMMENT 'file:///',
`cfe_center` varchar(255) collate utf8_bin default NULL,
`date_create` datetime default NULL,
`date_complete` datetime default NULL,
`date_subscribe` datetime default NULL,
`date_next_payement` datetime default NULL,
`date_ae_subscribe` datetime default NULL,
`siret` varchar(128) collate utf8_bin default NULL,
`current_quotation` bigint(20) unsigned default NULL,
`current_invoice` bigint(20) unsigned default NULL,
`has_create_quotation` tinyint(1) NOT NULL default '0',
`has_create_invoice` tinyint(1) NOT NULL default '0',
`created_by` int(20) NOT NULL default '0',
`updated_by` int(11) NOT NULL default '0',
`updated_date` datetime default NULL,
`abo_running` tinyint(1) NOT NULL default '1',
`show_bn` tinyint(1) NOT NULL default '1',
`taxe_type_activite` enum('NULL','ACHAT','SERVICE','BOTH') collate utf8_bin default NULL,
`taxe_categorie_activite` enum('NULL','COMMERCIALE','ARTISANALE','CIPAV','RSI') collate utf8_bin default NULL,
`taxe_liberatoire` enum('NULL','OUI','NON') collate utf8_bin default NULL,
`taxe_statut_accre` enum('NULL','OUI','NON','DK') collate utf8_bin default NULL,
`know` varchar(50) collate utf8_bin default NULL,
`sms_relance` int(11) default NULL,
`fdae` int(1) NOT NULL default '0',
`display_fdae` tinyint(1) NOT NULL default '0',
`show_dispense_immat` enum('RCS','RM','RSAC') collate utf8_bin default NULL,
`show_dispense_immat_city` varchar(255) collate utf8_bin default NULL,
`subscription_fdae` date default NULL,
`nbsocial` varchar(30) collate utf8_bin default NULL,
`atclic` int(1) NOT NULL default '0',
`merassurance` int(1) NOT NULL default '0',
`dossier_canceled` tinyint(1) NOT NULL default '0',
`dossier_canceled_date` datetime default NULL,
`tva_intra` varchar(20) collate utf8_bin default NULL,
`site_url` varchar(100) collate utf8_bin default NULL,
`freeguide` tinyint(1) NOT NULL default '0',
`hiscox` int(1) NOT NULL default '0',
`assurland` int(1) NOT NULL default '0',
`unpaid_advisor` int(11) default NULL,
`unpaid_date` datetime default NULL,
`ecl_send` tinyint(1) default NULL,
`ecl_date` datetime default NULL,
`birthdateyear` int(11) NOT NULL default '0',
`quaCategorie` varchar(500) collate utf8_bin default NULL,
`quaNature` varchar(500) collate utf8_bin default NULL,
`quaType` varchar(500) collate utf8_bin default NULL,
`april` int(1) NOT NULL default '0',
`date_guide` datetime default NULL,
`no_pub` tinyint(1) NOT NULL default '0',
`campaign_manual` tinyint(1) NOT NULL default '0',
`export_matmut` date default NULL,
`formality_date` datetime default NULL,
`call_count_commerciaux` int(11) default '0',
`call_count_assistance` int(11) default '0',
`call_last` datetime default NULL,
`prospect` tinyint(1) default NULL,
`gender_id` int(11) default NULL,
`birthdate` date default NULL,
`current_customer_source_history_id` int(11) default NULL,
`original_customer_source_history_id` int(11) default NULL,
`bounce` tinyint(1) NOT NULL default '0',
PRIMARY KEY (`id`),
UNIQUE KEY `UNIQ_81398E097D3656A4` (`account`),
UNIQUE KEY `UNIQ_81398E09E7927C74` (`email`),
UNIQUE KEY `UNIQ_81398E091193CB3F` (`customer_address`),
UNIQUE KEY `UNIQ_81398E09507DD4CC` (`business_address`),
UNIQUE KEY `UNIQ_81398E09BA38C653` (`formalities_center_address`),
KEY `num_dossier` (`num_dossier`),
KEY `sub_send_recovery` (`sub_sent_recovery`),
KEY `dossier_canceled` (`dossier_canceled`),
KEY `freeguide` (`freeguide`),
KEY `IDX_81398E09708A0E0` (`gender_id`),
KEY `IDX_81398E0935655550` (`current_customer_source_history_id`),
KEY `IDX_81398E0981A1F986` (`original_customer_source_history_id`)
) ENGINE=MyISAM AUTO_INCREMENT=433026 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
CREATE TABLE `sf_user_data` (
`id` int(11) NOT NULL auto_increment,
`user_id` bigint(20) unsigned NOT NULL,
`register_id` int(11) default NULL,
`insurance_id` int(11) default NULL,
`activity_started_at` date default NULL,
`accre_request_accepted` tinyint(1) default NULL,
`accre_request_accepted_at` date default NULL,
`declaration_frequency_months` smallint(6) default NULL,
`declaration_reminder` tinyint(1) default NULL,
`activities_number` smallint(6) default NULL,
`computed_main_activity_percent_total` double default NULL,
`computed_secondary_activity_percent_total` double default NULL,
`company_address_is_personal_address` tinyint(1) default NULL,
`register_city` varchar(255) collate utf8_unicode_ci default NULL,
`invoice_last_increment` smallint(6) NOT NULL default '0',
`quotation_last_increment` smallint(6) NOT NULL default '0',
`asset_last_increment` smallint(6) NOT NULL default '0',
`payplug_parameters` varchar(255) collate utf8_unicode_ci default NULL,
`displayed_first_connection_dialog` tinyint(1) NOT NULL default '0',
`displayed_first_invoice_display_dialog` tinyint(1) NOT NULL default '0',
`payplug_parameters_created_at` date default NULL,
`payplug_first_payment_at` date default NULL,
`latest_payplug_http_code` int(11) default NULL,
`register_number` varchar(255) collate utf8_unicode_ci default NULL,
`register_code` varchar(255) collate utf8_unicode_ci default NULL,
`register_bis_city` varchar(255) collate utf8_unicode_ci default NULL,
`register_bis_number` varchar(255) collate utf8_unicode_ci default NULL,
`registerBis_id` int(11) default NULL,
`main_activity_type_id` int(11) default NULL,
`secondary_activity_type_id` int(11) default NULL,
`declaration_reminder_popup` tinyint(1) default NULL,
`declaration_reminder_popup_latest_choice` smallint(6) default NULL COMMENT '1 = Me le rappeler demain, 2 = Ne plus afficher cette alerte',
`declaration_reminder_popup_latest_choice_date` date default NULL,
`main_activity_id` int(11) default NULL,
`secondary_activity_id` int(11) default NULL,
`primary_socio_economic_classification_id` int(11) default NULL,
`secondary_socio_economic_classification_id` int(11) default NULL,
`income_bracket_id` int(11) default NULL,
`main_activity_custom` varchar(255) collate utf8_unicode_ci default NULL,
`secondary_activity_custom` varchar(255) collate utf8_unicode_ci default NULL,
`default_further_information` longtext collate utf8_unicode_ci,
`gclid` varchar(255) collate utf8_unicode_ci default NULL,
`main_activity_type_old_id` smallint(6) default NULL,
`main_activity_nature_old_id` smallint(6) default NULL,
`secondary_activity_type_old_id` smallint(6) default NULL,
`secondary_activity_nature_old_id` smallint(6) default NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `UNIQ_E904BFD1A76ED395` (`user_id`),
UNIQUE KEY `UNIQ_E904BFD1D1E63CD1` (`insurance_id`),
KEY `IDX_E904BFD14976CB7E` (`register_id`),
KEY `IDX_E904BFD1DBC024CC` (`registerBis_id`),
KEY `IDX_E904BFD12E864BE8` (`main_activity_type_id`),
KEY `IDX_E904BFD132198C62` (`secondary_activity_type_id`),
KEY `IDX_E904BFD15543A800` (`main_activity_id`),
KEY `IDX_E904BFD1798B8812` (`secondary_activity_id`),
KEY `IDX_E904BFD1D17B29D3` (`primary_socio_economic_classification_id`),
KEY `IDX_E904BFD17758CEBC` (`secondary_socio_economic_classification_id`),
KEY `IDX_E904BFD1BAF920D3` (`income_bracket_id`)
) ENGINE=MyISAM AUTO_INCREMENT=116384 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
It seems like this simple amendment will be faster:
SELECT COUNT(DISTINCT a0_.id) sclr0
FROM account a0_
JOIN customer c1_
ON c1_.account = a0_.id
JOIN address a3_
ON c1_.customer_address = a3_.id
And if data integrity is important to you, consider switching to InnoDB.
Change LEFT JOIN address a3 to plain JOIN. That way, the optimizer could consider starting with address. And add INDEX(city) to address.
Currently, the EXPLAIN is showing hitting 405K rows in each of 3 tables. (1.2M total) With the above change, the optimizer would start with the city index, there by looking at, say 1K rows. After that, it would look up 1K rows in each of the other two tables. (3K total)
LEFT JOIN sf_user_data s2_ ON (s2_.user_id = a0_.id) seems to be totally useless; remove it. (Now down to 2K rows)
Don't blindly use (255), use reasonable numbers. In doing so, if identifier is not very big, make it the PRIMARY KEY and get rid of id.
It is extremely rare to have 6 different columns each being UNIQUE. I think you will run into business-logic trouble because of it.

Auto increment it's not working

I have a problem on my website with auto increment and I can't find a way to fix it...
It works with this table:
CREATE TABLE IF NOT EXISTS `users` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`username` varchar(40) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
`password` varchar(40) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
`loginhash` varchar(32) COLLATE utf8_unicode_ci DEFAULT NULL,
`id_level` int(10) NOT NULL DEFAULT '1',
`random` int(10) DEFAULT '0',
`email` varchar(30) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
`language` tinyint(4) NOT NULL DEFAULT '1',
`style` tinyint(4) NOT NULL DEFAULT '1',
`joined` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`lastconnect` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`lip` bigint(11) DEFAULT '0',
`downloaded` bigint(20) DEFAULT '0',
`uploaded` bigint(20) DEFAULT '0',
`avatar` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL,
`pid` varchar(32) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
`flag` tinyint(1) unsigned NOT NULL DEFAULT '0',
`topicsperpage` tinyint(3) unsigned NOT NULL DEFAULT '15',
`postsperpage` tinyint(3) unsigned NOT NULL DEFAULT '15',
`torrentsperpage` tinyint(3) unsigned NOT NULL DEFAULT '15',
`cip` varchar(15) COLLATE utf8_unicode_ci DEFAULT NULL,
`time_offset` varchar(4) COLLATE utf8_unicode_ci NOT NULL DEFAULT '0',
`temp_email` varchar(50) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
`flags` bigint(20) unsigned NOT NULL DEFAULT '7345036',
PRIMARY KEY (`id`),
UNIQUE KEY `username` (`username`),
KEY `id_level` (`id_level`),
KEY `pid` (`pid`),
KEY `cip` (`cip`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ;
But it doesn't work with this table:
CREATE TABLE IF NOT EXISTS `users` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`username` varchar(40) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
`password` varchar(40) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
`loginhash` varchar(32) COLLATE utf8_unicode_ci DEFAULT NULL,
`id_level` int(10) NOT NULL DEFAULT '1',
`random` int(10) DEFAULT '0',
`email` varchar(30) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
`language` tinyint(4) NOT NULL DEFAULT '1',
`style` tinyint(4) NOT NULL DEFAULT '1',
`joined` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`lastconnect` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`lip` bigint(11) DEFAULT '0',
`downloaded` bigint(20) DEFAULT '0',
`uploaded` bigint(20) DEFAULT '0',
`avatar` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL,
`pid` varchar(32) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
`flag` tinyint(1) unsigned NOT NULL DEFAULT '0',
`topicsperpage` tinyint(3) unsigned NOT NULL DEFAULT '15',
`postsperpage` tinyint(3) unsigned NOT NULL DEFAULT '15',
`torrentsperpage` tinyint(3) unsigned NOT NULL DEFAULT '15',
`cip` varchar(15) COLLATE utf8_unicode_ci DEFAULT NULL,
`time_offset` varchar(4) COLLATE utf8_unicode_ci NOT NULL DEFAULT '0',
`temp_email` varchar(50) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
`flags` bigint(20) unsigned NOT NULL DEFAULT '7345036',
`rank_switch` enum('yes','no') COLLATE utf8_unicode_ci NOT NULL DEFAULT 'no',
`old_rank` varchar(12) COLLATE utf8_unicode_ci NOT NULL DEFAULT '3',
`timed_rank` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`seedbonus` decimal(5,1) NOT NULL,
`on_forum` int(11) NOT NULL DEFAULT '0',
`on_topic` int(11) NOT NULL DEFAULT '0',
`custom_title` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL,
`invites` int(10) NOT NULL DEFAULT '0',
`invited_by` int(10) NOT NULL DEFAULT '0',
`invitedate` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`donor` varchar(10) COLLATE utf8_unicode_ci NOT NULL DEFAULT 'no',
`banfromforum` enum('yes','no') COLLATE utf8_unicode_ci NOT NULL DEFAULT 'no',
PRIMARY KEY (`id`),
UNIQUE KEY `username` (`username`),
KEY `id_level` (`id_level`),
KEY `pid` (`pid`),
KEY `cip` (`cip`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ;
Can anyone tell me where the problem is?

MySQL syntax error I don't understand [duplicate]

This question already has answers here:
1064 error in CREATE TABLE ... TYPE=MYISAM
(5 answers)
Closed 9 years ago.
MySQL generated by a dump of a v3.23.58 database:
DROP TABLE IF EXISTS `article`;
CREATE TABLE `article` (
`DATE` date NOT NULL default '0000-00-00',
`SECTION_ID` smallint(6) NOT NULL default '0',
`PRIORITY` int(11) NOT NULL default '0',
`AUTHOR1` int(100) NOT NULL default '1',
`AUTHOR2` varchar(100) NOT NULL default '',
`AUTHOR3` varchar(100) NOT NULL default '',
`AUTHOR4` varchar(100) NOT NULL default '',
`AUTHOR5` varchar(100) NOT NULL default '',
`AUTHOR6` int(100) NOT NULL default '0',
`AUTHOR7` int(100) NOT NULL default '0',
`AUTHOR8` int(100) NOT NULL default '0',
`AUTHOR9` int(100) NOT NULL default '0',
`AUTHOR10` int(100) NOT NULL default '0',
`AUTHOR_JOB` int(11) NOT NULL default '0',
`TITLE` varchar(100) NOT NULL default '',
`SUBHEAD` varchar(200) NOT NULL default '',
`TEXT` text NOT NULL,
`PULLQUOTE` text NOT NULL,
`SERIES` int(10) unsigned zerofill NOT NULL default '0000000000',
`TYPE` int(10) unsigned zerofill NOT NULL default '0000000000',
`VIEWS` int(10) unsigned zerofill NOT NULL default '0000000000',
`EMAILS` int(10) unsigned zerofill NOT NULL default '0000000000',
`BACKUPTEXT` text NOT NULL,
`BOWDOIN_VIEWS` int(10) unsigned zerofill NOT NULL default '0000000000',
PRIMARY KEY (`DATE`,`SECTION_ID`,`PRIORITY`),
FULLTEXT KEY `article_full_text` (`TITLE`,`TEXT`)
) TYPE=MyISAM;
Attempting to import it into a v5.5.19 database, I get this error:
[ERROR in query 2] You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'TYPE=MyISAM' at line 28
I've tried deconstructing it to a very basis skeleton but still get the error. Ought to be an obvious mistake if you have the eye for it.
Your version of MySQL probably requires that you edit query
replace
TYPE=MyISAM
with
ENGINE=MyISAM
if you are importing from script file then just:
Open script file
Find TYPE=MyISAM
Replace with ENGINE=MyISAM
save
Then try .
change last line
) TYPE=MyISAM;
to
) ENGINE=MyISAM
so all would be
DROP TABLE IF EXISTS `article`;
CREATE TABLE `article` (
`DATE` date NOT NULL default '0000-00-00',
`SECTION_ID` smallint(6) NOT NULL default '0',
`PRIORITY` int(11) NOT NULL default '0',
`AUTHOR1` int(100) NOT NULL default '1',
`AUTHOR2` varchar(100) NOT NULL default '',
`AUTHOR3` varchar(100) NOT NULL default '',
`AUTHOR4` varchar(100) NOT NULL default '',
`AUTHOR5` varchar(100) NOT NULL default '',
`AUTHOR6` int(100) NOT NULL default '0',
`AUTHOR7` int(100) NOT NULL default '0',
`AUTHOR8` int(100) NOT NULL default '0',
`AUTHOR9` int(100) NOT NULL default '0',
`AUTHOR10` int(100) NOT NULL default '0',
`AUTHOR_JOB` int(11) NOT NULL default '0',
`TITLE` varchar(100) NOT NULL default '',
`SUBHEAD` varchar(200) NOT NULL default '',
`TEXT` text NOT NULL,
`PULLQUOTE` text NOT NULL,
`SERIES` int(10) unsigned zerofill NOT NULL default '0000000000',
`TYPE` int(10) unsigned zerofill NOT NULL default '0000000000',
`VIEWS` int(10) unsigned zerofill NOT NULL default '0000000000',
`EMAILS` int(10) unsigned zerofill NOT NULL default '0000000000',
`BACKUPTEXT` text NOT NULL,
`BOWDOIN_VIEWS` int(10) unsigned zerofill NOT NULL default '0000000000',
PRIMARY KEY (`DATE`,`SECTION_ID`,`PRIORITY`),
FULLTEXT KEY `article_full_text` (`TITLE`,`TEXT`)
) ENGINE=MyISAM;