Link to home
Start Free TrialLog in
Avatar of jtcy
jtcy

asked on

MySQL weird import problem

I am trying to run this:

CREATE TABLE `wp_eblex_captcha` (
  `id` varchar(32) NOT NULL default '',
  `text` tinytext NOT NULL,
  `time` bigint(20) unsigned NOT NULL default '0',
  KEY `id` (`id`)
) ENGINE=MyISAM DEFAULT;

but the error says:

/* SQL Error: 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 'DEFAULT CHARSET=latin1' at line 6 */

I dont know what is wrong. It's PHP Version 5.1.6 and MySQL 5.0.27 .
Avatar of Aleksandar Bradarić
Aleksandar Bradarić
Flag of Serbia image

It sould say:
---
DEFAULT CHARACTER SET
---
No `=` either:
---
DEFAULT CHARACTER SET latin1
---
Avatar of jtcy
jtcy

ASKER

oH, SORRY...actually..this is my code:

CREATE TABLE `wp_eblex_captcha` (
  `id` varchar(32) NOT NULL default '',
  `text` tinytext NOT NULL,
  `time` bigint(20) unsigned NOT NULL default '0',
  KEY `id` (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

and it gave that error /* SQL Error: 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 'DEFAULT CHARSET=latin1' at line 6 */
Try with:
---
CREATE TABLE `wp_eblex_captcha` (
  `id` varchar(32) NOT NULL default '',
  `text` tinytext NOT NULL,
  `time` bigint(20) unsigned NOT NULL default '0',
  KEY `id` (`id`)
) ENGINE=MyISAM CHARSET latin1;
---

It works on 4.1.22 and 5.0.45. I'll see if I can get my hands on a 5.0.27 server to test it...
Avatar of jtcy

ASKER

so u mean i need to add default before charset?
I mean you do not need to add it.
Avatar of jtcy

ASKER

This is another one that has problem:

CREATE TABLE `wp_eblex_categories` (  `id` varchar(32) collate utf8_unicode_ci NOT NULL default '',  `parent` varchar(32) collate utf8_unicode_ci NOT NULL default '',  `title` mediumtext collate utf8_unicode_ci NOT NULL,  `description` mediumtext collate utf8_unicode_ci NOT NULL,  `keywords` mediumtext collate utf8_unicode_ci NOT NULL,  `nicename` mediumtext collate utf8_unicode_ci NOT NULL,  `time` bigint(20) unsigned NOT NULL default '0',  `visible` tinyint(1) NOT NULL default '0',  `zindex` bigint(20) NOT NULL default '0',  KEY `id` (`id`) ) ENGINE=MyISAM CHARSET=utf8 COLLATE=utf8_unicode_ci

/* SQL Error: 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 'collate utf8_unicode_ci NOT NULL default '',  `parent` varcha */
You already have the COLLATE set for the whole table, so it should be OK to remove it from the field:
---
CREATE TABLE `wp_eblex_categories` (  
  `id` varchar(32) NOT NULL default '',  
  `parent` varchar(32) NOT NULL default '',  
  `title` mediumtext NOT NULL,  
  `description` mediumtext NOT NULL,  
  `keywords` mediumtext NOT NULL,  
  `nicename` mediumtext NOT NULL,  
  `time` bigint(20) unsigned NOT NULL default '0',  
  `visible` tinyint(1) NOT NULL default '0',  
  `zindex` bigint(20) NOT NULL default '0',  
  KEY `id` (`id`)
) ENGINE=MyISAM CHARSET=utf8 COLLATE=utf8_unicode_ci
---
Avatar of jtcy

ASKER

CREATE TABLE `wp_eblex_categories` (   `id` varchar(32) NOT NULL default '',   `parent` varchar(32) NOT NULL default '',   `title` mediumtext NOT NULL,   `description` mediumtext NOT NULL,   `keywords` mediumtext NOT NULL,   `nicename` mediumtext NOT NULL,   `time` bigint(20) unsigned NOT NULL default '0',   `visible` tinyint(1) NOT NULL default '0',   `zindex` bigint(20) NOT NULL default '0',   KEY `id` (`id`) ) ENGINE=MyISAM CHARSET=utf8 COLLATE=utf8_unicode_ci                                                                                            CREATE TABLE `wp_eblex_links` (  `title` mediumtext collate utf8_unicode_ci NOT NULL,  `active` tinyint(4) NOT NULL default '0',  `nonreciprocal` tinyint(4) NOT NULL default '0',  `url` mediumtext collate utf8_unicode_ci NOT NULL,  `category` varchar(32) collate utf8_unicode_ci NOT NULL default '',  `description` mediumtext collate utf8_unicode_ci NOT NULL,  `email` mediumtext collate utf8_unicode_ci NOT NULL,  `reciprocalurl` mediumtext collate utf8_unicode_ci NOT NULL,  `status` tinytext collate utf8_unicode_ci NOT NULL,  `time` bigint(20) unsigned NOT NULL default '0',  `administratorcomment` mediumtext collate utf8_unicode_ci NOT NULL,  `zindex` bigint(20) NOT NULL default '0',  `id` varchar(32) collate utf8_unicode_ci NOT NULL default '',  KEY `id` (`id`) ) ENGINE=MyISAM CHARSET=utf8 COLLATE=utf8_unicode_ci

/* SQL Error: 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 'COLLATE=utf8_unicode_ci */
Avatar of jtcy

ASKER

CREATE TABLE `wp_eblex_categories` (   `id` varchar(32) NOT NULL default '',   `parent` varchar(32) NOT NULL default '',   `title` mediumtext NOT NULL,   `description` mediumtext NOT NULL,   `keywords` mediumtext NOT NULL,   `nicename` mediumtext NOT NULL,   `time` bigint(20) unsigned NOT NULL default '0',   `visible` tinyint(1) NOT NULL default '0',   `zindex` bigint(20) NOT NULL default '0',   KEY `id` (`id`) ) ENGINE=MyISAM CHARSET=utf8 COLLATE=utf8_unicode_ci                                                                                            

/* SQL Error: 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 'COLLATE=utf8_unicode_ci */
ASKER CERTIFIED SOLUTION
Avatar of Aleksandar Bradarić
Aleksandar Bradarić
Flag of Serbia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial